api-client/components/collections/AddFolder.vue

65 lines
1.5 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')">
<template #header>
<h3 class="heading">{{ $t("new_folder") }}</h3>
<div>
2021-07-03 13:14:58 +00:00
<ButtonSecondary icon="close" @click.native="hideModal" />
2020-12-11 10:29:03 +00:00
</div>
</template>
<template #body>
2021-07-17 17:40:28 +00:00
<div class="flex flex-col px-2">
2021-07-09 17:19:45 +00:00
<label
for="selectLabelAddFolder"
2021-07-17 17:40:28 +00:00
class="font-semibold text-xs px-4 pb-4"
2021-07-09 17:19:45 +00:00
>
{{ $t("label") }}
</label>
<input
id="selectLabelAddFolder"
v-model="name"
class="input"
type="text"
:placeholder="$t('my_new_folder')"
@keyup.enter="addFolder"
/>
</div>
</template>
<template #footer>
<span>
2021-07-03 13:14:58 +00:00
<ButtonPrimary :label="$t('save')" @click.native="addFolder" />
2021-07-09 17:19:45 +00:00
<ButtonSecondary :label="$t('cancel')" @click.native="hideModal" />
</span>
</template>
</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>