Commit 6968ae4a authored by Robert Knight's avatar Robert Knight

Remove client-side group sorting

The groups are already sorted in a suitable order
by the server, so they do not need to be sorted
again on the client.
parent db7af2a0
......@@ -16,16 +16,7 @@ function GroupListController($scope, $window) {
$scope.shouldShowShareLink = function (groupId) {
return $scope.expandedGroupId === groupId;
}
$scope.sortedGroups = function () {
return $scope.groups.all().concat().sort(function (a, b) {
if (a.public !== b.public) {
return a.public ? -1 : 1;
}
return a.name.localeCompare(b.name);
});
}
};
$scope.leaveGroup = function (groupId) {
var groupName = $scope.groups.get(groupId).name;
......
......@@ -31,27 +31,6 @@ describe('GroupListController', function () {
assert.equal($scope.shouldShowShareLink('group-a'), false);
assert.equal($scope.shouldShowShareLink('group-b'), true);
});
it('sorts groups', function () {
$scope.groups = {
all: function () {
return [{
id: 'c',
name: 'Zebrafish Study Group'
},{
id: 'a',
name: 'Antimatter Research'
},{
public: true
}];
},
};
var sorted = $scope.sortedGroups();
assert.ok(sorted[0].public);
assert.equal(sorted[1].name, 'Antimatter Research');
assert.equal(sorted[2].name, 'Zebrafish Study Group');
});
});
// returns true if a jQuery-like element has
......
......@@ -11,7 +11,7 @@
<i class="h-icon-arrow-drop-down"></i>
</span>
<ul class="dropdown-menu pull-right" role="menu">
<li ng-repeat="group in sortedGroups()">
<li ng-repeat="group in groups.all()">
<div ng-class="{'group-item': true, selected: group.id == groups.focused().id}"
ng-click="groups.focus(group.id)">
<!-- the group icon !-->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment