diff --git a/src/digimarks/static/css/digimarks.css b/src/digimarks/static/css/digimarks.css index 83dc082..7ff85b7 100644 --- a/src/digimarks/static/css/digimarks.css +++ b/src/digimarks/static/css/digimarks.css @@ -4,3 +4,45 @@ /** Navigation **/ +nav { + /*background: #666;*/ +} + +nav ul { +} + +body { + height: 125vh; + font-family: sans-serif; + margin-top: 3rem; + padding: 30px; +} + +main { + color: black; +} + +header { + background-color: white; + position: fixed; + top: 0; + left: 0; + right: 0; + height: 3rem; + display: flex; + align-items: center; + box-shadow: 0 0 6px 0 #666666; +} + +header * { + display: inline; +} + +header li { + margin: 20px; +} + +header li a { + color: black; + text-decoration: none; +} diff --git a/src/digimarks/static/js/digimarks.js b/src/digimarks/static/js/digimarks.js index 158bc81..7a889d9 100644 --- a/src/digimarks/static/js/digimarks.js +++ b/src/digimarks/static/js/digimarks.js @@ -49,7 +49,6 @@ document.addEventListener('alpine:init', () => { this.cache[this.userKey]['bookmarks'] = result; this.loading = false; }, - get filteredItems() { // return this.cache[this.userKey]['bookmarks'].filter( // i => i.title.includes(this.search) @@ -58,6 +57,18 @@ document.addEventListener('alpine:init', () => { return this.bookmarks.filter( i => i.title.match(new RegExp(this.search, "i")) ) + }, + async sortAlphabetically() { + 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 + { + + this.bookmarks.sort((a, b) => a.created_date.localeCompare(b.created_date)); + } } }) }); diff --git a/src/digimarks/templates/user_index.html b/src/digimarks/templates/user_index.html index 93ed770..df3bf25 100644 --- a/src/digimarks/templates/user_index.html +++ b/src/digimarks/templates/user_index.html @@ -7,24 +7,33 @@ x-init="$store.digimarks.userKey = '{{ user_key }}'; $store.digimarks.loadCache(); $store.digimarks.getBookmarks()" x-data=""> + + digimarks tags add bookmark + + + - Welcome user ! Tryout: - - - Loading... - + Welcome user ! + Loading... + + + sort a-z + sort date asc + sort date desc + + {% endblock %}
Welcome user !
+ sort a-z + sort date asc + sort date desc +