adds asc/desc order icons
This commit is contained in:
parent
7d17737569
commit
87fbc9783f
|
@ -4,6 +4,9 @@
|
||||||
"description": "List arc-hive collections for Omeka",
|
"description": "List arc-hive collections for Omeka",
|
||||||
"main": "webpack.config.js",
|
"main": "webpack.config.js",
|
||||||
"devDependencies": {
|
"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",
|
"axios": "^0.23.0",
|
||||||
"babel-loader": "^8.2.3",
|
"babel-loader": "^8.2.3",
|
||||||
"vue": "^2.6.14",
|
"vue": "^2.6.14",
|
||||||
|
|
|
@ -28,10 +28,38 @@ This file is part of ArciveList.
|
||||||
data-accordion-item disabled>
|
data-accordion-item disabled>
|
||||||
<a href="#" class="accordion-title">
|
<a href="#" class="accordion-title">
|
||||||
<ul class="">
|
<ul class="">
|
||||||
<li class="title">Title</li>
|
<li class="title"
|
||||||
<li class="curator">Artist</li>
|
v-on:click="setActiveColumn('title')">
|
||||||
<li class="collection-name">Collection</li>
|
Title
|
||||||
<li class="date">Date</li>
|
<span class="ascToggle"
|
||||||
|
v-bind:class="{ activeColumn: isActiveCol('title')}">
|
||||||
|
<font-awesome-icon :icon="getOrderIcon('title')" size="1x" />
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li class="curator"
|
||||||
|
v-on:click="setActiveColumn('artist')">
|
||||||
|
Artist
|
||||||
|
<span class="ascToggle"
|
||||||
|
v-bind:class="{ activeColumn: isActiveCol('artist')}">
|
||||||
|
<font-awesome-icon :icon="getOrderIcon('artist')" size="1x" />
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li class="collection-name"
|
||||||
|
v-on:click="setActiveColumn('collection')">
|
||||||
|
Collection
|
||||||
|
<span class="ascToggle"
|
||||||
|
v-bind:class="{ activeColumn: isActiveCol('collection')}">
|
||||||
|
<font-awesome-icon :icon="getOrderIcon('collection')" size="1x" />
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li class="date"
|
||||||
|
v-on:click="setActiveColumn('date')">
|
||||||
|
Date
|
||||||
|
<span class="ascToggle"
|
||||||
|
v-bind:class="{ activeColumn: isActiveCol('date')}">
|
||||||
|
<font-awesome-icon :icon="getOrderIcon('date')" size="1x" />
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</a>
|
</a>
|
||||||
<div class="accordion-content"
|
<div class="accordion-content"
|
||||||
|
@ -90,15 +118,23 @@ This file is part of ArciveList.
|
||||||
<script>
|
<script>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { mapMutations, mapGetters } from 'vuex'
|
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';
|
import Search from './search.vue';
|
||||||
export default {
|
export default {
|
||||||
name: "List",
|
name: "List",
|
||||||
components: {
|
components: {
|
||||||
'Search': Search
|
FontAwesomeIcon,
|
||||||
|
Search
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
//sites: Array,
|
columns_order: {'title': 'asc', 'artist': 'asc', 'collection': 'asc', 'date': 'asc'},
|
||||||
|
active_column: 'title',
|
||||||
|
column_order: 'asc',
|
||||||
|
faSortAlphaUp: faSortAlphaUp,
|
||||||
|
faSortAlphaDown: faSortAlphaDown,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -112,7 +148,19 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
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([
|
...mapGetters([
|
||||||
'getDisplayedSites'
|
'getDisplayedSites'
|
||||||
]),
|
]),
|
||||||
|
@ -129,6 +177,11 @@ export default {
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style scoped>
|
||||||
|
.ascToggle {
|
||||||
|
color: lightgray;
|
||||||
|
}
|
||||||
|
.activeColumn {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -5,7 +5,6 @@ This file is part of ArciveList.
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<nav class="">
|
<nav class="">
|
||||||
<form class="search"
|
<form class="search"
|
||||||
|
@ -26,46 +25,23 @@ This file is part of ArciveList.
|
||||||
</nav>
|
</nav>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { mapMutations } from 'vuex'
|
import { mapMutations } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Search",
|
name: "Search",
|
||||||
components: {
|
|
||||||
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
search_text: "",
|
search_text: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
|
||||||
|
|
||||||
},
|
|
||||||
ready: function () {
|
|
||||||
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
/*
|
|
||||||
var self = this;
|
|
||||||
axios.get(this.api_endpoint +'/sites', {
|
|
||||||
})
|
|
||||||
.then(function (response) {
|
|
||||||
console.log(response.data)
|
|
||||||
self.sites = response.data
|
|
||||||
})
|
|
||||||
.catch(function (error) {
|
|
||||||
console.log(error);
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
search: function() {
|
search: function() {
|
||||||
console.log(this.search_text)
|
console.log(this.search_text)
|
||||||
this.setSearchText(this.search_text)
|
this.setSearchText(this.search_text)
|
||||||
var search_url = this.api_endpoint + this.search_text;
|
var api_endpoint = '/api/collections/search?fulltext_search='
|
||||||
|
var search_url = api_endpoint + this.search_text;
|
||||||
var self = this;
|
var self = this;
|
||||||
axios.get(search_url, {
|
axios.get(search_url, {
|
||||||
})
|
})
|
||||||
|
@ -77,23 +53,10 @@ export default {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
site_url: function(slug) {
|
|
||||||
return this.base_url + '/s/' + slug
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
...mapMutations([
|
...mapMutations([
|
||||||
'setFilteredSites', 'setSearchText'
|
'setFilteredSites', 'setSearchText'
|
||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
watched: {
|
|
||||||
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
api_endpoint: function() {
|
|
||||||
return '/api/collections/search?fulltext_search='
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue