Former-commit-id: 25141b4324b7355bd9e1c5a04a8e51d7e6a293ed [formerly 350423a47322359a33c8db7743aa88b25f9c44e1] [formerly 8a7042ed9763a6b9c8ba1cf88c027aed6b663f08 [formerly 2936858adb]]
Former-commit-id: 8cf7d99da15f44c3572366bdae279e78c0bfd2c7 [formerly e35c21fe57fd3e6f2342248f1d228ae454a6285d]
Former-commit-id: 60db7620422cd88fa960388d2002ff82b36efe9c
34 lines
897 B
Vue
34 lines
897 B
Vue
<template>
|
|
<button @click="change" aria-label="Switch View" title="Switch View" class="action" id="switch-view-button">
|
|
<i class="material-icons">{{ icon() }}</i>
|
|
<span>Switch view</span>
|
|
</button>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'switch-button',
|
|
methods: {
|
|
change: function (event) {
|
|
// If we are on mobile we should close the dropdown.
|
|
this.$store.commit('closeHovers')
|
|
|
|
let display = 'mosaic'
|
|
|
|
if (this.$store.state.req.display === 'mosaic') {
|
|
display = 'list'
|
|
}
|
|
|
|
this.$store.commit('listingDisplay', display)
|
|
let path = this.$store.state.baseURL
|
|
if (path === '') path = '/'
|
|
document.cookie = `display=${display}; max-age=31536000; path=${path}`
|
|
},
|
|
icon: function () {
|
|
if (this.$store.state.req.display === 'mosaic') return 'view_list'
|
|
return 'view_module'
|
|
}
|
|
}
|
|
}
|
|
</script>
|