basic sorting added to project list page

This commit is contained in:
Henry Oswald 2014-07-17 17:34:09 +01:00
parent c683eab9e2
commit ca6e8a7d40
2 changed files with 10 additions and 6 deletions

View file

@ -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

View file

@ -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 = ""