paricafe/src/client/app/desktop/views/pages/deck/deck.tl-column.vue

74 lines
1.7 KiB
Vue
Raw Normal View History

2018-06-05 08:54:03 -05:00
<template>
<div>
2018-06-06 16:13:57 -05:00
<x-column :id="column.id" :menu="menu" :name="name">
2018-06-05 08:54:03 -05:00
<span slot="header">
2018-06-06 16:13:57 -05:00
<template v-if="column.type == 'home'">%fa:home%</template>
<template v-if="column.type == 'local'">%fa:R comments%</template>
<template v-if="column.type == 'global'">%fa:globe%</template>
<template v-if="column.type == 'list'">%fa:list%</template>
<span>{{ name }}</span>
2018-06-05 08:54:03 -05:00
</span>
2018-06-05 15:18:08 -05:00
2018-06-06 16:13:57 -05:00
<div class="editor" v-if="edit">
<mk-switch v-model="column.isMediaOnly" @change="onChangeSettings" text="%i18n:@is-media-only%"/>
<mk-switch v-model="column.isMediaView" @change="onChangeSettings" text="%i18n:@is-media-view%"/>
</div>
<x-list-tl v-if="column.type == 'list'" :list="column.list" :media-only="column.isMediaOnly"/>
<x-tl v-else :src="column.type" :media-only="column.isMediaOnly"/>
2018-06-05 08:54:03 -05:00
</x-column>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import XColumn from './deck.column.vue';
import XTl from './deck.tl.vue';
2018-06-05 15:18:08 -05:00
import XListTl from './deck.list-tl.vue';
2018-06-05 08:54:03 -05:00
export default Vue.extend({
components: {
XColumn,
2018-06-05 15:18:08 -05:00
XTl,
XListTl
2018-06-05 08:54:03 -05:00
},
props: {
2018-06-05 15:18:08 -05:00
column: {
type: Object,
required: true
2018-06-05 08:54:03 -05:00
}
2018-06-06 16:13:57 -05:00
},
data() {
return {
edit: false,
menu: [{
content: '%fa:cog% %i18n:@edit%',
onClick: () => {
this.edit = !this.edit;
}
}]
}
},
computed: {
name(): string {
if (this.column.name) return this.column.name;
switch (this.column.type) {
case 'home': return '%i18n:common.deck.home%';
case 'local': return '%i18n:common.deck.local%';
case 'global': return '%i18n:common.deck.global%';
case 'list': return this.column.list.title;
}
}
},
methods: {
onChangeSettings(v) {
this.$store.dispatch('settings/saveDeck');
}
2018-06-05 15:18:08 -05:00
}
2018-06-05 08:54:03 -05:00
});
</script>