api-client/components/collections/graphql/AddFolder.vue

63 lines
1.3 KiB
Vue
Raw Normal View History

2021-03-18 14:55:12 +00:00
<template>
<SmartModal
v-if="show"
:title="$t('folder.new')"
@close="$emit('hide-modal')"
>
<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"
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>
</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>
2021-03-18 14:55:12 +00:00
</SmartModal>
</template>
<script lang="ts">
import Vue from "vue"
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 {
name: null,
2021-03-18 14:55:12 +00:00
}
},
methods: {
addFolder() {
// 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}`,
})
this.hideModal()
2021-03-18 14:55:12 +00:00
},
hideModal() {
this.name = null
2021-03-18 14:55:12 +00:00
this.$emit("hide-modal")
},
},
})
2021-03-18 14:55:12 +00:00
</script>