Skip to content

Commit

Permalink
site-admin: Change ordering of lists
Browse files Browse the repository at this point in the history
  • Loading branch information
doortts committed Apr 22, 2017
1 parent 2e8562b commit c954740
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 38 deletions.
24 changes: 5 additions & 19 deletions app/controllers/SiteApp.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
/**
* Yobi, Project Hosting SW
*
* Copyright 2012 NAVER Corp.
* http://yobi.io
*
* @author Hwi Ahn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Yona, 21st Century Project Hosting SW
* <p>
* Copyright Yona & Yobi Authors & NAVER Corp.
* https://yona.io
**/
package controllers;

import com.avaje.ebean.Page;
Expand Down
4 changes: 4 additions & 0 deletions app/models/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ public static Long create(Project newProject) {

public static Page<Project> findByName(String name, int pageSize,
int pageNum) {
if(StringUtils.isBlank(name)){
return find.where().order().desc("createdDate").findPagingList(pageSize).getPage(pageNum);
}

return find.where().ilike("name", "%" + decodeUrlString(name) + "%")
.findPagingList(pageSize).getPage(pageNum);
}
Expand Down
2 changes: 1 addition & 1 deletion app/models/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public static Page<User> findUsers(int pageNum, String query, UserState state) {
el.endJunction();
}

return el.findPagingList(USER_COUNT_PER_PAGE).getPage(pageNum);
return el.order().desc("createdDate").findPagingList(USER_COUNT_PER_PAGE).getPage(pageNum);
}

/**
Expand Down
26 changes: 8 additions & 18 deletions app/views/site/projectList.scala.html
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
@**
* Yobi, Project Hosting SW
* Yona, 21st Century Project Hosting SW
*
* Copyright 2012 NAVER Corp.
* http://yobi.io
*
* @author Hwi Ahn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright Yona & Yobi Authors & NAVER Corp.
* https://yona.io
**@
@(message: String, currentPage: com.avaje.ebean.Page[Project], filter:String)

@import utils.TemplateHelper._
@import utils.JodaDateUtil._

@siteMngLayout(message) {
<div class="title_area">
Expand Down Expand Up @@ -54,10 +41,13 @@ <h2 class="pull-left">@Messages("site.sidebar.projectList")</h2>
@project.owner/@project.name
</a>
</div>
<div class="span5 listitem-col">
<div class="span4 listitem-col">
@project.overview
</div>
<div class="span2 listitem-col">
@geYMDDate(project.createdDate)
</div>
<div class="span1 listitem-col">
<button class="ybtn ybtn-danger" data-project-name="@project.owner/@project.name" data-toggle="delete-project" data-href="@routes.SiteApp.deleteProject(project.id)">@Messages("button.delete")</button>
</div>
</li>
Expand Down

0 comments on commit c954740

Please sign in to comment.