aboutsummaryrefslogtreecommitdiff
path: root/front-end/src/views/Blog/components/Channels/ChannelTable.vue
blob: cdf15e0524b6a5bc5eb853577026717355828511 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<template>
    <thead>
        <tr>
            <th>Name</th>
            <th>Path</th>
            <th>Index</th>
            <th>Feed?</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        <tr v-for="channel in channels" :key="channel.id" class="table-row">
            <td>
                {{ channel.name }}
            </td>
            <td>
                {{ channel.path }}
            </td>
            <td>
                {{ channel.index }}
            </td>
            <td>
                {{ feedEnabled(channel) }}
            </td>
            <td class="w-12">
                <button class="btn xs no-border" @click="openEdit(channel)">
                    <fa-icon icon="pencil" />
                </button>
            </td>
        </tr>
    </tbody>
</template>

<script setup lang="ts">
import { BlogChannel } from '@vnuge/cmnext-admin';
import { toRefs } from 'vue';
const emit = defineEmits(['open-edit'])

const props = defineProps<{
    channels:BlogChannel[]
}>()

const { channels } = toRefs(props)

const feedEnabled = (channel: BlogChannel) => channel.feed ? 'Enabled' : 'Disabled'
const openEdit = (channel: BlogChannel) => emit('open-edit', channel)

</script>