From ff6fd632b32d5dc77ca5bfc954b96e8fe1a086a6 Mon Sep 17 00:00:00 2001 From: Mateus Machado Luna Date: Wed, 16 Oct 2019 15:38:17 -0300 Subject: [PATCH] Adds textual search to Taxonomies list. --- src/admin/pages/lists/collections-page.vue | 11 +++-- src/admin/pages/lists/taxonomies-page.vue | 53 ++++++++++++++++++++-- src/js/store/modules/taxonomy/actions.js | 5 +- 3 files changed, 59 insertions(+), 10 deletions(-) diff --git a/src/admin/pages/lists/collections-page.vue b/src/admin/pages/lists/collections-page.vue index 688fccc40..cbb1acca4 100644 --- a/src/admin/pages/lists/collections-page.vue +++ b/src/admin/pages/lists/collections-page.vue @@ -122,8 +122,10 @@ + + -
+
+ + + +
+ + + + +
+
@@ -231,6 +250,7 @@ status: '', order: 'asc', ordeBy: 'date', + searchQuery: '', sortingOptions: [ { label: this.$i18n.get('label_title'), value: 'title' }, { label: this.$i18n.get('label_creation_date'), value: 'date' }, @@ -305,7 +325,8 @@ taxonomiesPerPage: this.taxonomiesPerPage, status: this.status, order: this.order, - orderby: this.orderBy + orderby: this.orderBy, + search: this.searchQuery }) .then((res) => { this.isLoading = false; @@ -318,6 +339,10 @@ getLastTaxonomyNumber() { let last = (Number(this.taxonomiesPerPage * (this.page - 1)) + Number(this.taxonomiesPerPage)); return last > this.total ? this.total : last; + }, + searchTaxonomies() { + this.page = 1; + this.load(); } }, computed: { @@ -371,10 +396,15 @@ display: inline-flex; justify-content: space-between; align-items: center; + flex-wrap: wrap; width: 100%; .header-item { + margin-bottom: 0 !important; + &:first-child { + margin-right: auto; + } &:not(:last-child) { padding-right: 0.5em; } @@ -387,9 +417,13 @@ cursor: default; } - .button { - display: flex; - align-items: center; + &:not(:first-child) { + .button { + display: flex; + align-items: center; + border-radius: 0 !important; + height: 1.95rem !important; + } } .field { @@ -405,10 +439,19 @@ font-size: 1.3125rem !important; max-width: 26px; } + + .icon { + pointer-events: all; + cursor: pointer; + color: $blue5; + height: 27px; + font-size: 18px !important; + height: 1.75rem !important; + } } @media screen and (max-width: 769px) { - height: 60px; + height: 160px; margin-top: -0.5em; padding-top: 0.9em; diff --git a/src/js/store/modules/taxonomy/actions.js b/src/js/store/modules/taxonomy/actions.js index 487649118..a8e886552 100644 --- a/src/js/store/modules/taxonomy/actions.js +++ b/src/js/store/modules/taxonomy/actions.js @@ -45,7 +45,7 @@ export const updateTaxonomy = ({ commit }, taxonomy) => { }); }; -export const fetch = ({ commit }, { page, taxonomiesPerPage, status, order, orderby } ) => { +export const fetch = ({ commit }, { page, taxonomiesPerPage, status, order, orderby, search } ) => { return new Promise((resolve, reject) => { let endpoint = `/taxonomies?paged=${page}&perpage=${taxonomiesPerPage}&context=edit`; @@ -54,6 +54,9 @@ export const fetch = ({ commit }, { page, taxonomiesPerPage, status, order, orde if (order != undefined && order != '' && orderby != undefined && orderby != '') endpoint = endpoint + '&order=' + order + '&orderby=' + orderby; + + if (search != undefined && search != '') + endpoint = endpoint + '&search=' + search; axios.tainacan.get(endpoint) .then(res => {