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

58 lines
1.4 KiB
Vue
Raw Normal View History

2021-03-18 14:55:12 +00:00
<template>
2021-05-18 16:09:55 +00:00
<SmartModal v-if="show" @close="$emit('hide-modal')">
<template #header>
2021-08-02 15:27:18 +00:00
<h3 class="heading">{{ $t("folder.edit") }}</h3>
2021-08-07 03:37:26 +00:00
<ButtonSecondary icon="close" @click.native="hideModal" />
</template>
<template #body>
2021-07-17 17:40:28 +00:00
<div class="flex flex-col px-2">
<label for="selectLabelGqlEditFolder" class="font-semibold px-4 pb-4">
2021-07-09 17:19:45 +00:00
{{ $t("label") }}
</label>
<input
id="selectLabelGqlEditFolder"
v-model="name"
class="input"
type="text"
:placeholder="folder.name"
@keyup.enter="editFolder"
/>
</div>
</template>
<template #footer>
<span>
2021-07-03 13:14:58 +00:00
<ButtonPrimary :label="$t('save')" @click.native="editFolder" />
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"
import { editGraphqlFolder } from "~/newstore/collections"
2021-03-18 14:55:12 +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
folder: { type: Object, default: () => {} },
folderPath: { type: String, default: null },
2021-03-18 14:55:12 +00:00
},
data() {
return {
name: null,
2021-03-18 14:55:12 +00:00
}
},
methods: {
editFolder() {
editGraphqlFolder(this.folderPath, { ...this.folder, name: this.name })
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>