2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
|
|
|
<div class="qkcjvfiv">
|
|
|
|
<portal to="icon"><fa :icon="faListUl"/></portal>
|
2020-07-24 18:36:39 +02:00
|
|
|
<portal to="title" v-t="'manageLists'"></portal>
|
2020-01-29 20:37:25 +01:00
|
|
|
|
|
|
|
<mk-button @click="create" primary class="add"><fa :icon="faPlus"/> {{ $t('createList') }}</mk-button>
|
|
|
|
|
|
|
|
<mk-pagination :pagination="pagination" #default="{items}" class="lists" ref="list">
|
2020-02-06 06:23:01 +01:00
|
|
|
<div class="list _panel" v-for="(list, i) in items" :key="list.id">
|
2020-02-06 16:19:40 +01:00
|
|
|
<router-link :to="`/my/lists/${ list.id }`">{{ list.name }}</router-link>
|
2020-01-29 20:37:25 +01:00
|
|
|
</div>
|
|
|
|
</mk-pagination>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import { faListUl, faPlus } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import MkPagination from '../../components/ui/pagination.vue';
|
|
|
|
import MkButton from '../../components/ui/button.vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
metaInfo() {
|
|
|
|
return {
|
|
|
|
title: this.$t('manageLists') as string,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
components: {
|
|
|
|
MkPagination,
|
|
|
|
MkButton,
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
pagination: {
|
|
|
|
endpoint: 'users/lists/list',
|
|
|
|
limit: 10,
|
|
|
|
},
|
|
|
|
faListUl, faPlus
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
async create() {
|
|
|
|
const { canceled, result: name } = await this.$root.dialog({
|
|
|
|
title: this.$t('enterListName'),
|
|
|
|
input: true
|
|
|
|
});
|
|
|
|
if (canceled) return;
|
|
|
|
await this.$root.api('users/lists/create', { name: name });
|
|
|
|
this.$refs.list.reload();
|
|
|
|
this.$root.dialog({
|
|
|
|
type: 'success',
|
|
|
|
iconOnly: true, autoClose: true
|
|
|
|
});
|
|
|
|
},
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.qkcjvfiv {
|
|
|
|
> .add {
|
2020-02-08 07:11:12 +01:00
|
|
|
margin: 0 auto var(--margin) auto;
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
> .lists {
|
|
|
|
> .list {
|
|
|
|
display: flex;
|
|
|
|
padding: 16px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|