2021-03-18 14:55:12 +00:00
|
|
|
<template>
|
2021-08-08 07:12:29 +00:00
|
|
|
<SmartModal
|
|
|
|
|
v-if="show"
|
|
|
|
|
:title="$t('folder.new')"
|
|
|
|
|
@close="$emit('hide-modal')"
|
|
|
|
|
>
|
2021-06-30 08:46:02 +00:00
|
|
|
<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
|
|
|
<input
|
|
|
|
|
id="selectLabelGqlAddFolder"
|
|
|
|
|
v-model="name"
|
2021-08-08 17:14:05 +00:00
|
|
|
v-focus
|
2021-08-07 09:21:13 +00:00
|
|
|
class="input floating-input"
|
|
|
|
|
placeholder=" "
|
2021-07-09 17:19:45 +00:00
|
|
|
type="text"
|
|
|
|
|
@keyup.enter="addFolder"
|
|
|
|
|
/>
|
2021-08-07 09:21:13 +00:00
|
|
|
<label for="selectLabelGqlAddFolder">
|
|
|
|
|
{{ $t("label") }}
|
|
|
|
|
</label>
|
2021-07-09 17:19:45 +00:00
|
|
|
</div>
|
2021-06-30 08:46:02 +00:00
|
|
|
</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" />
|
2021-06-30 08:46:02 +00:00
|
|
|
</span>
|
|
|
|
|
</template>
|
2021-03-18 14:55:12 +00:00
|
|
|
</SmartModal>
|
|
|
|
|
</template>
|
|
|
|
|
|
2021-05-28 03:22:17 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import Vue from "vue"
|
2021-05-20 08:54:14 +00:00
|
|
|
|
2021-05-28 03:22:17 +00:00
|
|
|
export default Vue.extend({
|
2021-03-18 14:55:12 +00:00
|
|
|
props: {
|
|
|
|
|
show: Boolean,
|
2021-05-18 16:09:55 +00:00
|
|
|
folderPath: { type: String, default: null },
|
|
|
|
|
collectionIndex: { type: Number, default: null },
|
2021-03-18 14:55:12 +00:00
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2021-05-20 08:54:14 +00:00
|
|
|
name: null,
|
2021-03-18 14:55:12 +00:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
addFolder() {
|
2021-05-28 03:22:17 +00:00
|
|
|
// TODO: Blocking when name is null ?
|
|
|
|
|
|
2021-03-18 14:55:12 +00:00
|
|
|
this.$emit("add-folder", {
|
|
|
|
|
name: this.name,
|
|
|
|
|
path: this.folderPath || `${this.collectionIndex}`,
|
|
|
|
|
})
|
2021-05-20 08:54:14 +00:00
|
|
|
this.hideModal()
|
2021-03-18 14:55:12 +00:00
|
|
|
},
|
|
|
|
|
hideModal() {
|
2021-05-20 08:54:14 +00:00
|
|
|
this.name = null
|
2021-03-18 14:55:12 +00:00
|
|
|
this.$emit("hide-modal")
|
|
|
|
|
},
|
|
|
|
|
},
|
2021-05-28 03:22:17 +00:00
|
|
|
})
|
2021-03-18 14:55:12 +00:00
|
|
|
</script>
|