2019-10-01 22:20:23 +00:00
|
|
|
<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">
|
2020-02-25 02:06:23 +00:00
|
|
|
<h3 class="title">{{ $t("new_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-01-15 03:40:14 +00:00
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
v-model="name"
|
|
|
|
|
:placeholder="$t('my_new_folder')"
|
2020-01-30 15:05:22 +00:00
|
|
|
@keyup.enter="addNewFolder"
|
2020-01-15 03:40:14 +00:00
|
|
|
/>
|
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">
|
2020-02-25 02:06:23 +00:00
|
|
|
{{ $t("cancel") }}
|
2019-10-25 08:14:34 +00:00
|
|
|
</button>
|
2019-12-17 19:13:15 +00:00
|
|
|
<button class="icon primary" @click="addNewFolder">
|
2020-02-25 02:06:23 +00:00
|
|
|
{{ $t("save") }}
|
2019-12-17 19:13:15 +00:00
|
|
|
</button>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
2019-10-25 08:14:34 +00:00
|
|
|
</div>
|
|
|
|
|
</modal>
|
2019-10-01 22:20:23 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-06-21 03:54:45 +00:00
|
|
|
import { fb } from "~/helpers/fb"
|
2020-06-19 17:37:40 +00:00
|
|
|
|
2019-11-02 05:32:21 +00:00
|
|
|
export default {
|
|
|
|
|
props: {
|
|
|
|
|
show: Boolean,
|
|
|
|
|
collection: Object,
|
2020-02-24 18:44:50 +00:00
|
|
|
collectionIndex: Number,
|
2019-11-02 05:32:21 +00:00
|
|
|
},
|
|
|
|
|
components: {
|
2020-06-21 03:54:45 +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: {
|
|
|
|
|
addNewFolder() {
|
2020-02-25 02:06:23 +00:00
|
|
|
this.$store.commit("postwoman/addNewFolder", {
|
2019-11-02 05:32:21 +00:00
|
|
|
folder: { name: this.$data.name },
|
2020-02-24 18:44:50 +00:00
|
|
|
collectionIndex: this.$props.collectionIndex,
|
|
|
|
|
})
|
|
|
|
|
this.hideModal()
|
2020-06-15 09:33:31 +00:00
|
|
|
this.syncCollections()
|
|
|
|
|
},
|
|
|
|
|
syncCollections() {
|
|
|
|
|
if (fb.currentUser !== null) {
|
|
|
|
|
if (fb.currentSettings[0].value) {
|
|
|
|
|
fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-01 22:20:23 +00:00
|
|
|
},
|
2019-11-02 05:32:21 +00:00
|
|
|
hideModal() {
|
2020-02-25 02:06:23 +00:00
|
|
|
this.$emit("hide-modal")
|
2020-02-24 18:44:50 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
2019-10-22 15:57:48 +00:00
|
|
|
</script>
|