diff --git a/services/web/app/views/project/list/project-list.jade b/services/web/app/views/project/list/project-list.jade index 2f853e9d97..05489defb9 100644 --- a/services/web/app/views/project/list/project-list.jade +++ b/services/web/app/views/project/list/project-list.jade @@ -122,13 +122,13 @@ select-all, type="checkbox" ) - span.header Title + span.header(ng-click="changePredicate('name')") Title .col-md-2 - span.header Owner + span.header(ng-click="changePredicate('accessLevel')") Owner .col-md-4 - span.header Last Modified + span.header(ng-click="changePredicate('lastUpdated')") Last Modified li.project_entry.container-fluid( - ng-repeat="project in visibleProjects | orderBy:'lastUpdated':true", + ng-repeat="project in visibleProjects | orderBy:predicate:reverse", ng-controller="ProjectListItemController" ) .row diff --git a/services/web/public/coffee/main/project-list.coffee b/services/web/public/coffee/main/project-list.coffee index 3b8a379226..8035bc9054 100644 --- a/services/web/public/coffee/main/project-list.coffee +++ b/services/web/public/coffee/main/project-list.coffee @@ -57,6 +57,8 @@ define [ $scope.allSelected = false $scope.selectedProjects = [] $scope.filter = "all" + $scope.predicate = "lastUpdated" + $scope.reverse = false $scope.windowHeight = $window.innerHeight angular.element($window).bind "resize", () -> @@ -75,8 +77,10 @@ define [ project.tags ||= [] project.tags.push tag - $scope.$watch "searchText", (value) -> - $scope.updateVisibleProjects() + $scope.changePredicate = (newPredicate)-> + if $scope.predicate == newPredicate + $scope.reverse = !$scope.reverse + $scope.predicate = newPredicate $scope.clearSearchText = () -> $scope.searchText = ""