filebrowser/_assets/src/components/SwitchViewButton.vue
Henrique Dias 8b98abedea Working better :)
Former-commit-id: 935ee3c7cceb4deb31965501a80c202a0034da52 [formerly 3a68553e1ac0af9dad51bd2b8eab1152959a4dc2] [formerly 596f9d6676cceafac0e9fe66a9137683482c2685 [formerly 191b31e9774be6e9a2a12a8336db40fe14eb94b5]]
Former-commit-id: f0179a58c53f057f1b6f0f19b40fc2308b0edd15 [formerly 5151c85d599e8b3772dabab24973004105c29881]
Former-commit-id: c28c7b95e5ea1b1d9ae2af046f49cc5ffa848385
2017-07-03 11:04:14 +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>