filebrowser/_assets/src/components/buttons/SwitchViewButton.vue
Henrique Dias bae3c341f6 Organisation and reworking stuff
Former-commit-id: 01621444e51316cc9f125e4d541caf9d6c9d37a1 [formerly 733a976b594348754cb34b27c594c485fd5b0df4] [formerly 36a2f39b0e471ee231343ebaed474ae247764b37 [formerly 8d891f0d513d21282adfd9e1b9f206b69f4b17c7]]
Former-commit-id: 505c381e3135c0e0607e984a37e908672e8100a3 [formerly a6e70288608c6ee1edc380af76ee3e82ff62861a]
Former-commit-id: d946069b4f8ad1b19da7ee087901762b3f4b7936
2017-07-03 11:20:36 +01:00

29 lines
717 B
Vue

<template>
<button @click="change" aria-label="Switch View" title="Switch View" class="action">
<i class="material-icons">{{ icon() }}</i>
<span>Switch view</span>
</button>
</template>
<script>
export default {
name: 'switch-button',
methods: {
change: function (event) {
let display = 'mosaic'
if (this.$store.state.req.display === 'mosaic') {
display = 'list'
}
this.$store.commit('listingDisplay', display)
document.cookie = `display=${display}; max-age=31536000; path=${this.$store.state.baseURL}`
},
icon: function () {
if (this.$store.state.req.display === 'mosaic') return 'view_list'
return 'view_module'
}
}
}
</script>