api-client/components/collections/AddFolder.vue

69 lines
1.6 KiB
Vue
Raw Normal View History

2019-10-01 22:20:23 +00:00
<template>
2021-05-18 16:09:55 +00:00
<SmartModal v-if="show" @close="$emit('hide-modal')">
2019-10-25 08:14:34 +00:00
<div slot="header">
2020-12-11 10:29:03 +00:00
<div class="row-wrapper">
<h3 class="heading">{{ $t("new_folder") }}</h3>
2020-12-11 10:29:03 +00:00
<div>
<button class="icon button" @click="hideModal">
2020-12-11 10:29:03 +00:00
<i class="material-icons">close</i>
</button>
</div>
</div>
2019-10-25 08:14:34 +00:00
</div>
2020-12-11 16:54:34 +00:00
<div slot="body" class="flex flex-col">
2020-12-11 10:29:03 +00:00
<label for="selectLabel">{{ $t("label") }}</label>
<input
id="selectLabel"
v-model="name"
class="input"
2021-05-18 16:09:55 +00:00
type="text"
2020-12-11 10:29:03 +00:00
:placeholder="$t('my_new_folder')"
@keyup.enter="addFolder"
/>
2019-10-25 08:14:34 +00:00
</div>
<div slot="footer">
2020-09-22 17:06:37 +00:00
<div class="row-wrapper">
2019-12-17 19:13:15 +00:00
<span></span>
<span>
<button class="icon button" @click="hideModal">
{{ $t("cancel") }}
2019-10-25 08:14:34 +00:00
</button>
<button class="icon button primary" @click="addFolder">
{{ $t("save") }}
2019-12-17 19:13:15 +00:00
</button>
</span>
</div>
2019-10-25 08:14:34 +00:00
</div>
</SmartModal>
2019-10-01 22:20:23 +00:00
</template>
<script>
2019-11-02 05:32:21 +00:00
export default {
props: {
show: Boolean,
2021-05-18 16:09:55 +00:00
folder: { type: Object, default: () => {} },
folderPath: { type: String, default: null },
collectionIndex: { type: Number, default: null },
2019-11-02 05:32:21 +00:00
},
data() {
return {
name: null,
2020-02-24 18:44:50 +00:00
}
2019-11-02 05:32:21 +00:00
},
methods: {
addFolder() {
this.$emit("add-folder", {
name: this.name,
folder: this.folder,
path: this.folderPath || `${this.collectionIndex}`,
2020-02-24 18:44:50 +00:00
})
this.hideModal()
},
2019-11-02 05:32:21 +00:00
hideModal() {
this.name = null
this.$emit("hide-modal")
2020-02-24 18:44:50 +00:00
},
},
}
2019-10-22 15:57:48 +00:00
</script>