From e82d583dce3d8d141a3fa0b7bbbdaf2b1ab2c6b0 Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 2 Apr 2021 16:41:57 -0500 Subject: [PATCH] Added sort and filter to all volumes page --- stashr/static/css/stashr.css | 1 + stashr/static/js/stashr.js | 11 ++++++- stashr/templates/all_volumes_page.html | 43 ++++++++++++++++++++++---- 3 files changed, 48 insertions(+), 7 deletions(-) diff --git a/stashr/static/css/stashr.css b/stashr/static/css/stashr.css index 1c7ed61..170d2a5 100644 --- a/stashr/static/css/stashr.css +++ b/stashr/static/css/stashr.css @@ -14,6 +14,7 @@ ul { list-style-type: none; } .bg-mine { background: #3e3e44; } .stashr-menu { transition: 0.5s; } +.stashr-submenu { transition: 0.5s; z-index:-5; margin-top:-100% !important; } .stashr-footer { position:fixed; bottom:0; z-index:6; } .stashr-item_container { overflow: hidden; } .stashr-poster_container { position:relative; overflow: hidden; } diff --git a/stashr/static/js/stashr.js b/stashr/static/js/stashr.js index 1632e9c..c43bbed 100644 --- a/stashr/static/js/stashr.js +++ b/stashr/static/js/stashr.js @@ -15,4 +15,13 @@ function toggleMenu() { } else { document.getElementById('sideMenu').style.marginLeft = "0px" } -} \ No newline at end of file +} + +function toggleSubMenu() { + var margin = getComputedStyle(document.querySelector('.stashr-submenu')).marginTop; + if ( margin == '0px' ) { + document.querySelector('.stashr-submenu').style.setProperty('margin-top', '-100%', 'important') + } else { + document.querySelector('.stashr-submenu').style.setProperty('margin-top', '0px', 'important') + } +} diff --git a/stashr/templates/all_volumes_page.html b/stashr/templates/all_volumes_page.html index 2554ce9..f1563da 100644 --- a/stashr/templates/all_volumes_page.html +++ b/stashr/templates/all_volumes_page.html @@ -6,6 +6,7 @@ {% block header %} {{ emit_tep('all_volumes_page_header') }} + {% endblock %} {% block content %} @@ -113,8 +114,30 @@ Vue.component('volumes', { template: `
-
- +
+ + + + +
+
+
+ + +
+
+ + +
    @@ -126,12 +149,20 @@ Vue.component('volumes', {
`, - data() { return { loading: true, search: '', } }, + data() { return { loading: true, search: '', filter: '', sorted: 'volume_sort_title'} }, computed: { filteredList() { - return this.volumes.filter(volume => { - return volume.volume_name.toLowerCase().includes(this.search.toLowerCase()) - }) + if (this.sorted.toLowerCase() == 'progress') { + return this.volumes + .filter(volume => { return volume.volume_name.toLowerCase().includes(this.search.toLowerCase()) }) + .filter(volume => { return volume.volume_status.toString().includes(this.filter) }) + .sort((a, b) => (a.volume_have / a.volume_total) - (b.volume_have / b.volume_total)) + } else { + return this.volumes + .filter(volume => { return volume.volume_name.toLowerCase().includes(this.search.toLowerCase()) }) + .filter(volume => { return volume.volume_status.toString().includes(this.filter) }) + .sort((a, b) => a[this.sorted] - b[this.sorted]) + } }, }, delimiters: ["[[","]]"],