doortts doortts 2013-04-24
feature: add sorted view myproject list in front page
@26b348e388f0506529c0e69afba58e0a7b1dd91d
app/views/index.scala.html
--- app/views/index.scala.html
+++ app/views/index.scala.html
@@ -274,13 +274,38 @@
                     
                     <div class="project-count-wrap">
                         @Messages("project.myproject") <i>&middot;</i><span class="p-num">@projects.size()</span>
+                        <div class="project-list-sort">
+                            <span class="ordertype-date">
+                                @if( orderString == "createdDate desc" ){
+                                    <a href="@routes.Application.index()?order=createdDate"><strong>@Messages("orderby.recent")</strong> <i class="icon-chevron-down"></i></a>
+                                } else {
+                                    @if( orderString == "createdDate" ){
+                                        <a href="@routes.Application.index()?order=createdDate desc"><strong>@Messages("orderby.recent")</strong> <i class="icon-chevron-up"></i></a>
+                                    } else {
+                                        <a href="@routes.Application.index()?order=createdDate">@Messages("orderby.recent")</a>
+                                    }
+                                }
+                            </span><span class="delimeter"> | </span><span class="ordertype-name">
+                                @if( orderString == "name desc" ){
+                                    <a href="@routes.Application.index()?order=name"><strong>@Messages("orderby.name")</strong> <i class="icon-chevron-down"></i></a>
+                                } else {
+                                    @if( orderString == "name" ){
+                                        <a href="@routes.Application.index()?order=name desc"><strong>@Messages("orderby.name")</strong> <i class="icon-chevron-up"></i></a>
+                                    } else {
+                                        <a href="@routes.Application.index()?order=name">@Messages("orderby.name")</a>
+                                    }
+                                }
+                            </span>
+                        </div>
                     </div>
+
 
 					<div class="my-projects">
                     <ul class="unstyled">
-                        @myProjectList(projects)
+                        @myProjectList(projects, orderString)
                     </ul>
 
+
                     <div class="btn-wrap">
                         <a href="@routes.ProjectApp.newProjectForm()"><i class="ico ico-pencil"></i> @Messages("button.newProject")</a>
                     </div>
app/views/myProjectList.scala.html
--- app/views/myProjectList.scala.html
+++ app/views/myProjectList.scala.html
@@ -1,4 +1,4 @@
-@(projects:List[Project])
+@(projects:List[Project], orderString:String)
 @import utils.TemplateHelper._
 @if(projects != null){
     @for(project <- projects){
@@ -17,6 +17,7 @@
                 <div class="ico-wrap">
                     <i class="ico ico-gray-arrow-right"></i>
                 </div>
+
             <div class="project-detail hidden">
                 <ul class="contributors unstyled">
                     @project.projectUser.map{ member =>
Add a comment
List