mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
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:
@@ -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);
|
||||
|
||||
|
||||
@@ -15,6 +15,10 @@ habitrpg.controller('SortableInventoryController', ['$scope',
|
||||
}
|
||||
};
|
||||
|
||||
$scope.setGrouping = function (grouping) {
|
||||
$scope.groupingChoice = grouping;
|
||||
};
|
||||
|
||||
$scope.orderChoice = 'set';
|
||||
$scope.setOrder($scope.orderChoice);
|
||||
}]);
|
||||
|
||||
Reference in New Issue
Block a user