mirror of
https://github.com/aquatix/digimarks.git
synced 2025-12-07 02:35:10 +01:00
Also order z-a
This commit is contained in:
@@ -58,15 +58,17 @@ document.addEventListener('alpine:init', () => {
|
||||
i => i.title.match(new RegExp(this.search, "i"))
|
||||
)
|
||||
},
|
||||
async sortAlphabetically() {
|
||||
async sortAlphabetically(order = 'asc') {
|
||||
if (order === 'desc') {
|
||||
this.bookmarks.sort((a, b) => b.title.localeCompare(a.title));
|
||||
} else {
|
||||
this.bookmarks.sort((a, b) => a.title.localeCompare(b.title));
|
||||
}
|
||||
},
|
||||
async sortCreated(order = 'asc') {
|
||||
if (order === 'desc') {
|
||||
this.bookmarks.sort((a, b) => b.created_date.localeCompare(a.created_date));
|
||||
} else
|
||||
{
|
||||
|
||||
} else {
|
||||
this.bookmarks.sort((a, b) => a.created_date.localeCompare(b.created_date));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
<p>
|
||||
<button @click="$store.digimarks.sortAlphabetically()">sort a-z</button>
|
||||
<button @click="$store.digimarks.sortAlphabetically('desc')">sort z-a</button>
|
||||
<button @click="$store.digimarks.sortCreated()">sort date asc</button>
|
||||
<button @click="$store.digimarks.sortCreated('desc')">sort date desc</button>
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user