filebrowser/_assets/src/components/SwitchViewButton.vue
Henrique Dias 713e89eb68 Updates and more features
Former-commit-id: 9f1f09311813203910d5b323ba80712553ee2741 [formerly 0be00be1de305d786affc6bf0886aed9b20fbc51] [formerly 04597463117e94830b24b87faaaccf3d35284427 [formerly 3f2dc3f1c56a7a636a836d36b94c052f55f32d93]]
Former-commit-id: 8d26cc1d96faed73c7974ea7e5e78bf268af3ad9 [formerly a083ac8f68c90a636843c3565bd349657c0ec383]
Former-commit-id: ef10f3b3c388d65ceac40785b45dbac190a6cc99
2017-06-30 16:04:01 +01:00

32 lines
694 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 '../utils/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>