mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-03 04:29:40 +00:00
Adding a couple of watch statements should make the party order auto-update on changes.
This commit is contained in:
parent
5752f75c46
commit
5ac73aca9e
1 changed files with 16 additions and 3 deletions
|
|
@ -4,9 +4,20 @@ habitrpg.controller("HeaderCtrl", ['$scope', 'Groups', 'User',
|
|||
function($scope, Groups, User) {
|
||||
|
||||
$scope.Math = window.Math;
|
||||
$scope.user = User.user;
|
||||
|
||||
$scope.party = Groups.party(function(){
|
||||
$scope.partyMinusSelf = _.sortBy(
|
||||
var triggerResort = function() {
|
||||
$scope.partyMinusSelf = resortParty();
|
||||
};
|
||||
|
||||
triggerResort();
|
||||
$scope.$watch('user.party.order', triggerResort);
|
||||
$scope.$watch('user.party.orderAscending', triggerResort);
|
||||
});
|
||||
|
||||
function resortParty() {
|
||||
var result = _.sortBy(
|
||||
_.filter($scope.party.members, function(member){
|
||||
return member._id !== User.user._id;
|
||||
}),
|
||||
|
|
@ -41,8 +52,10 @@ habitrpg.controller("HeaderCtrl", ['$scope', 'Groups', 'User',
|
|||
}
|
||||
)
|
||||
if (User.user.party.orderAscending == "descending") {
|
||||
$scope.partyMinusSelf = $scope.partyMinusSelf.reverse()
|
||||
result = result.reverse()
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue