2020-11-15 05:04:54 +02:00
|
|
|
<template>
|
2020-11-15 05:34:47 +02:00
|
|
|
<div class="_section qtcaoidl">
|
2021-04-20 17:22:59 +03:00
|
|
|
<MkButton @click="create" primary class="add"><i class="fas fa-plus"></i> {{ $ts.add }}</MkButton>
|
2020-11-15 05:04:54 +02:00
|
|
|
|
|
|
|
<div class="_content">
|
2020-11-15 05:34:47 +02:00
|
|
|
<MkPagination :pagination="pagination" #default="{items}" ref="list" class="list">
|
2021-04-10 12:17:42 +03:00
|
|
|
<MkA v-for="item in items" :key="item.id" :to="`/clips/${item.id}`" class="item _panel _gap">
|
2020-11-15 05:34:47 +02:00
|
|
|
<b>{{ item.name }}</b>
|
|
|
|
<div v-if="item.description" class="description">{{ item.description }}</div>
|
|
|
|
</MkA>
|
2020-11-15 05:04:54 +02:00
|
|
|
</MkPagination>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue';
|
2021-03-23 10:30:14 +02:00
|
|
|
import MkPagination from '@client/components/ui/pagination.vue';
|
|
|
|
import MkButton from '@client/components/ui/button.vue';
|
|
|
|
import * as os from '@client/os';
|
2021-04-10 06:54:12 +03:00
|
|
|
import * as symbols from '@client/symbols';
|
2020-11-15 05:04:54 +02:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
|
|
|
MkPagination,
|
|
|
|
MkButton,
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2021-04-10 06:54:12 +03:00
|
|
|
[symbols.PAGE_INFO]: {
|
2020-12-26 03:47:36 +02:00
|
|
|
title: this.$ts.clip,
|
2021-04-20 17:22:59 +03:00
|
|
|
icon: 'fas fa-paperclip',
|
2020-11-15 05:04:54 +02:00
|
|
|
action: {
|
2021-04-20 17:22:59 +03:00
|
|
|
icon: 'fas fa-plus',
|
2020-11-15 05:04:54 +02:00
|
|
|
handler: this.create
|
|
|
|
}
|
|
|
|
},
|
|
|
|
pagination: {
|
|
|
|
endpoint: 'clips/list',
|
|
|
|
limit: 10,
|
|
|
|
},
|
|
|
|
draft: null,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
async create() {
|
2020-12-26 03:47:36 +02:00
|
|
|
const { canceled, result } = await os.form(this.$ts.createNewClip, {
|
2020-11-15 05:04:54 +02:00
|
|
|
name: {
|
|
|
|
type: 'string',
|
2020-12-26 03:47:36 +02:00
|
|
|
label: this.$ts.name
|
2020-11-15 05:04:54 +02:00
|
|
|
},
|
|
|
|
description: {
|
|
|
|
type: 'string',
|
|
|
|
required: false,
|
|
|
|
multiline: true,
|
2020-12-26 03:47:36 +02:00
|
|
|
label: this.$ts.description
|
2020-11-15 05:04:54 +02:00
|
|
|
},
|
|
|
|
isPublic: {
|
|
|
|
type: 'boolean',
|
2020-12-26 03:47:36 +02:00
|
|
|
label: this.$ts.public,
|
2020-11-15 07:18:25 +02:00
|
|
|
default: false
|
2020-11-15 05:04:54 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
if (canceled) return;
|
|
|
|
|
|
|
|
os.apiWithDialog('clips/create', result);
|
|
|
|
},
|
|
|
|
|
|
|
|
onClipCreated() {
|
|
|
|
this.$refs.list.reload();
|
|
|
|
this.draft = null;
|
|
|
|
},
|
|
|
|
|
|
|
|
onClipDeleted() {
|
|
|
|
this.$refs.list.reload();
|
|
|
|
},
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
2020-11-15 05:34:47 +02:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.qtcaoidl {
|
|
|
|
> .add {
|
|
|
|
margin: 0 auto 16px auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
> ._content {
|
|
|
|
> .list {
|
|
|
|
> .item {
|
|
|
|
display: block;
|
|
|
|
padding: 16px;
|
|
|
|
|
|
|
|
> .description {
|
|
|
|
margin-top: 8px;
|
|
|
|
padding-top: 8px;
|
2021-04-10 06:40:50 +03:00
|
|
|
border-top: solid 0.5px var(--divider);
|
2020-11-15 05:34:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|