From 87fbc9783f4e3b52e7298d5e7115469462baae12 Mon Sep 17 00:00:00 2001 From: buttle Date: Thu, 4 Nov 2021 14:37:07 +0100 Subject: [PATCH] adds asc/desc order icons --- package.json | 3 ++ src/components/archiveList.vue | 71 +++++++++++++++++++++++++++++----- src/components/search.vue | 41 +------------------- 3 files changed, 67 insertions(+), 48 deletions(-) diff --git a/package.json b/package.json index a5e4e2e..079e5ee 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,9 @@ "description": "List arc-hive collections for Omeka", "main": "webpack.config.js", "devDependencies": { + "@fortawesome/fontawesome-svg-core": "^1.2.36", + "@fortawesome/free-solid-svg-icons": "^5.15.4", + "@fortawesome/vue-fontawesome": "^2.0.6", "axios": "^0.23.0", "babel-loader": "^8.2.3", "vue": "^2.6.14", diff --git a/src/components/archiveList.vue b/src/components/archiveList.vue index 3dbe048..d444920 100644 --- a/src/components/archiveList.vue +++ b/src/components/archiveList.vue @@ -28,10 +28,38 @@ This file is part of ArciveList. data-accordion-item disabled>
import axios from 'axios'; import { mapMutations, mapGetters } from 'vuex' +import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' +import { faSortAlphaUp } from '@fortawesome/free-solid-svg-icons' +import { faSortAlphaDown } from '@fortawesome/free-solid-svg-icons' import Search from './search.vue'; export default { name: "List", components: { - 'Search': Search + FontAwesomeIcon, + Search }, data() { return { - //sites: Array, + columns_order: {'title': 'asc', 'artist': 'asc', 'collection': 'asc', 'date': 'asc'}, + active_column: 'title', + column_order: 'asc', + faSortAlphaUp: faSortAlphaUp, + faSortAlphaDown: faSortAlphaDown, }; }, created() { @@ -112,7 +148,19 @@ export default { }, methods: { - + setActiveColumn: function(name) { + if (this.active_column == name) { + this.columns_order[name] = this.columns_order[name] == 'asc' ? 'desc' : 'asc' + } else { + this.active_column = name + } + }, + isActiveCol: function(name) { + return name == this.active_column ? true : false + }, + getOrderIcon: function(name) { + return this.columns_order[name] == 'asc' ? faSortAlphaUp : faSortAlphaDown + }, ...mapGetters([ 'getDisplayedSites' ]), @@ -129,6 +177,11 @@ export default { }; - diff --git a/src/components/search.vue b/src/components/search.vue index 2b4f572..3cba903 100644 --- a/src/components/search.vue +++ b/src/components/search.vue @@ -5,7 +5,6 @@ This file is part of ArciveList. # SPDX-License-Identifier: AGPL-3.0-or-later --> - -