mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Add inventory sorting buttons based on name, attribute, and set (armoire): - Each gear[klass] has its own sorting buttons and sorting state including costume classes - The attributes sort descending when selected, then by sum of all attributes - There is no default sort - The armoire also sorts by set which sorts by item[set] descending, it does not sort within a set (ex "1 of 3" vs "2 of 3") - Name sorts by .text() ascending
20 lines
532 B
JavaScript
20 lines
532 B
JavaScript
habitrpg.controller('SortableInventoryController', ['$scope',
|
|
function ($scope) {
|
|
|
|
// doing this in a function causes 10 $digest iteration error
|
|
attributeSort = {
|
|
con: ['-con', '-(con+int+per+str)'],
|
|
int: ['-int', '-(con+int+per+str)'],
|
|
per: ['-per', '-(con+int+per+str)'],
|
|
str: ['-str', '-(con+int+per+str)'],
|
|
name: 'text()',
|
|
set: 'set'
|
|
}
|
|
|
|
$scope.setOrder = function(order) {
|
|
if (order in attributeSort) {
|
|
$scope.order = attributeSort[order];
|
|
}
|
|
};
|
|
}]);
|