api-client/components/collections/editFolder.vue

72 lines
1.6 KiB
Vue
Raw Normal View History

<template>
2019-10-25 08:14:34 +00:00
<modal v-if="show" @close="show = false">
<div slot="header">
<ul>
<li>
<div class="flex-wrap">
<h3 class="title">{{ $t("edit_folder") }}</h3>
2019-10-25 08:14:34 +00:00
<div>
<button class="icon" @click="hideModal">
<i class="material-icons">close</i>
</button>
</div>
</div>
</li>
</ul>
</div>
<div slot="body">
<ul>
<li>
2020-02-24 18:44:50 +00:00
<input type="text" v-model="name" :placeholder="folder.name" @keyup.enter="editFolder" />
2019-10-25 08:14:34 +00:00
</li>
</ul>
</div>
<div slot="footer">
2019-12-17 19:13:15 +00:00
<div class="flex-wrap">
<span></span>
<span>
<button class="icon" @click="hideModal">
{{ $t("cancel") }}
2019-10-25 08:14:34 +00:00
</button>
2019-12-17 19:13:15 +00:00
<button class="icon primary" @click="editFolder">
{{ $t("save") }}
2019-12-17 19:13:15 +00:00
</button>
</span>
</div>
2019-10-25 08:14:34 +00:00
</div>
</modal>
</template>
<script>
2019-11-02 05:32:21 +00:00
export default {
props: {
show: Boolean,
collection: Object,
collectionIndex: Number,
folder: Object,
2020-02-24 18:44:50 +00:00
folderIndex: Number,
2019-11-02 05:32:21 +00:00
},
components: {
2020-03-03 11:57:53 +00:00
modal: () => import("../../components/ui/modal"),
2019-11-02 05:32:21 +00:00
},
data() {
return {
2020-02-24 18:44:50 +00:00
name: undefined,
}
2019-11-02 05:32:21 +00:00
},
methods: {
editFolder() {
this.$store.commit("postwoman/editFolder", {
2019-11-02 05:32:21 +00:00
collectionIndex: this.$props.collectionIndex,
folder: { ...this.$props.folder, name: this.$data.name },
2020-02-24 18:44:50 +00:00
folderIndex: this.$props.folderIndex,
})
this.hideModal()
},
2019-11-02 05:32:21 +00:00
hideModal() {
this.$emit("hide-modal")
2020-02-24 18:44:50 +00:00
},
},
}
</script>