From 5ac73aca9ef3db1ca5f91362764343001b672294 Mon Sep 17 00:00:00 2001 From: "R. Daniel Hammond" Date: Sun, 15 Mar 2015 20:49:13 -0400 Subject: [PATCH 1/2] Adding a couple of watch statements should make the party order auto-update on changes. --- website/public/js/controllers/headerCtrl.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/website/public/js/controllers/headerCtrl.js b/website/public/js/controllers/headerCtrl.js index ada83f24c2..9424eca81d 100644 --- a/website/public/js/controllers/headerCtrl.js +++ b/website/public/js/controllers/headerCtrl.js @@ -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; + } } ]); From a46c5c0225c2bf2ee6f90009952e12c00283478f Mon Sep 17 00:00:00 2001 From: "R. Daniel Hammond" Date: Sun, 15 Mar 2015 20:52:50 -0400 Subject: [PATCH 2/2] We shouldn't need the "refresh to see changes" now. --- common/locales/en/groups.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/locales/en/groups.json b/common/locales/en/groups.json index 68d451311c..923bd677f9 100644 --- a/common/locales/en/groups.json +++ b/common/locales/en/groups.json @@ -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",