Merge pull request #4863 from rdhammond/InstantPartySource

Instant party source
This commit is contained in:
Alys 2015-03-20 06:46:38 +10:00
commit 5198050cd2
2 changed files with 17 additions and 4 deletions

View file

@ -21,7 +21,7 @@
"communityGuidelinesRead2": "before chatting.",
"party": "Party",
"createAParty": "Create A Party",
"updatedParty": "Party settings updated. Please refresh the page to see the changes.",
"updatedParty": "Party settings updated.",
"noPartyText": "You are either not in a party or your party is taking a while to load. You can either create one and invite friends, or if you want to join an existing party, have them enter your Unique User ID below and then come back here to look for the invitation:",
"LFG": "To advertise your new party or find one to join, go to the <%= linkStart %>Party Wanted (Looking for Group)<%= linkEnd %> Guild.",
"create": "Create",

View file

@ -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;
}
}
]);