feat: Add group by button to equipment page

Closes #7636
Closes #7651

This commit creates a new button on the equipment page that allows the user to group their equipment type (body location) instead of simply by class.
This commit is contained in:
Husman
2016-06-11 14:16:10 -07:00
committed by Blade Barringer
parent a58bf4ee2b
commit 9b12d46741
7 changed files with 62 additions and 11 deletions

View File

@@ -53,12 +53,25 @@ habitrpg.controller("InventoryCtrl",
$scope.$watch('user.items.quests', function(quest){ $scope.questCount = countStacks(quest); }, true);
$scope.$watch('user.items.gear', function(gear){
$scope.gear = {};
$scope.gearByClass = {};
$scope.gearByType = {};
_.each(gear.owned, function(v,key){
if (v === false) return;
if (v === false) {
return;
}
var item = Content.gear.flat[key];
if (!$scope.gear[item.klass]) $scope.gear[item.klass] = [];
$scope.gear[item.klass].push(item);
if (!$scope.gearByClass[item.klass]) {
$scope.gearByClass[item.klass] = [];
}
$scope.gearByClass[item.klass].push(item);
if (!$scope.gearByType[item.type]) {
$scope.gearByType[item.type] = [];
}
$scope.gearByType[item.type].push(item);
})
}, true);