mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 11:14:01 +02:00
Update sorting for folders.
This commit is contained in:
parent
42b82884b3
commit
bb1f26d581
1 changed files with 63 additions and 19 deletions
|
@ -149,11 +149,38 @@
|
||||||
>
|
>
|
||||||
<v-icon>mdi-minus</v-icon>
|
<v-icon>mdi-minus</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn medium tile color="blue" class="mx-1 folder-button"
|
|
||||||
@click="sortFolder(item.uuid);"
|
<v-menu bottom left>
|
||||||
|
<template v-slot:activator="{ on }">
|
||||||
|
<v-btn
|
||||||
|
medium tile
|
||||||
|
color="blue"
|
||||||
|
class="mx-1 folder-button"
|
||||||
|
v-on="on"
|
||||||
>
|
>
|
||||||
<v-icon>mdi-ab-testing</v-icon>
|
<v-icon>mdi-sort</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<v-list color="grey darken-3">
|
||||||
|
<v-list-item
|
||||||
|
@click="sortFolder(item.uuid, 'az');"
|
||||||
|
>
|
||||||
|
<v-list-item-title>A-Z</v-list-item-title>
|
||||||
|
<v-list-item-action>
|
||||||
|
<v-icon large>mdi-sort-alphabetical-ascending</v-icon>
|
||||||
|
</v-list-item-action>
|
||||||
|
</v-list-item>
|
||||||
|
<v-list-item
|
||||||
|
@click="sortFolder(item.uuid, 'za');"
|
||||||
|
>
|
||||||
|
<v-list-item-title>Z-A</v-list-item-title>
|
||||||
|
<v-list-item-action>
|
||||||
|
<v-icon large>mdi-sort-alphabetical-descending</v-icon>
|
||||||
|
</v-list-item-action>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
</v-menu>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<v-container fluid>
|
<v-container fluid>
|
||||||
|
@ -304,10 +331,11 @@ export default {
|
||||||
|
|
||||||
return returnedItemIconColor;
|
return returnedItemIconColor;
|
||||||
},
|
},
|
||||||
sortFolder: function(uuid) {
|
sortFolder: function(uuid, sort) {
|
||||||
var findFolder = this.searchForItem(uuid);
|
var findFolder = this.searchForItem(uuid);
|
||||||
|
|
||||||
if (findFolder) {
|
if (findFolder) {
|
||||||
|
if (sort === "az") {
|
||||||
findFolder.returnedItem.items.sort(function(a, b) {
|
findFolder.returnedItem.items.sort(function(a, b) {
|
||||||
var nameA = a.name.toUpperCase(); // ignore upper and lowercase
|
var nameA = a.name.toUpperCase(); // ignore upper and lowercase
|
||||||
var nameB = b.name.toUpperCase(); // ignore upper and lowercase
|
var nameB = b.name.toUpperCase(); // ignore upper and lowercase
|
||||||
|
@ -322,6 +350,22 @@ export default {
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (sort === "za") {
|
||||||
|
findFolder.returnedItem.items.sort(function(a, b) {
|
||||||
|
var nameA = a.name.toUpperCase(); // ignore upper and lowercase
|
||||||
|
var nameB = b.name.toUpperCase(); // ignore upper and lowercase
|
||||||
|
if (nameA > nameB) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (nameA < nameB) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// names must be equal
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
searchForItem: function(uuid) {
|
searchForItem: function(uuid) {
|
||||||
var foundItem = this.recursiveSingularSearch(uuid, this.itemsForIterator);
|
var foundItem = this.recursiveSingularSearch(uuid, this.itemsForIterator);
|
||||||
|
|
Loading…
Reference in a new issue