filebrowser/_assets/src/components/SwitchViewButton.vue
Henrique Dias 5d84c22a91 updates
Former-commit-id: 419fb04f20d9be50358b0d87285fa92855906f97 [formerly fd974c12d0c06b0bde92e201f636c977a1638608] [formerly faa13a4e0c06720f217e7e4387ca0bf9e367365d [formerly 39f39cca2951018d900ff777b36a9b8f720c4356]]
Former-commit-id: b2df427ca1f97e407a549848649bad020eb5453f [formerly 484d32224ca56fa68d6b5b0f01626d69eaa0528b]
Former-commit-id: 81103561b811e456c4e50dd0d8a6e555e8584839
2017-06-30 12:43:43 +01:00

32 lines
688 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>
import page from '../page'
export default {
name: 'switch-button',
methods: {
change: function (event) {
let url = window.location.pathname + '?display='
if (this.$store.state.req.data.display === 'mosaic') {
url += 'list'
} else {
url += 'mosaic'
}
page.open(url)
},
icon: function () {
if (this.$store.state.req.data.display === 'mosaic') return 'view_list'
return 'view_module'
}
}
}
</script>