api-client/packages/hoppscotch-app/components/collections/EditFolder.vue

64 lines
1.3 KiB
Vue
Raw Normal View History

<template>
<SmartModal
v-if="show"
:title="$t('folder.edit')"
@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="selectLabelEditFolder"
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"
autocomplete="off"
2021-07-09 17:19:45 +00:00
@keyup.enter="editFolder"
/>
2021-08-07 09:21:13 +00:00
<label for="selectLabelEditFolder">
{{ $t("action.label") }}
2021-08-07 09:21:13 +00:00
</label>
2021-07-09 17:19:45 +00:00
</div>
</template>
<template #footer>
<span>
<ButtonPrimary :label="$t('action.save')" @click.native="editFolder" />
<ButtonSecondary
:label="$t('action.cancel')"
@click.native="hideModal"
/>
</span>
</template>
</SmartModal>
</template>
<script>
2021-08-24 03:44:46 +00:00
import { defineComponent } from "@nuxtjs/composition-api"
export default defineComponent({
2019-11-02 05:32:21 +00:00
props: {
show: Boolean,
},
data() {
return {
name: null,
2020-02-24 18:44:50 +00:00
}
2019-11-02 05:32:21 +00:00
},
methods: {
editFolder() {
2021-08-08 06:31:36 +00:00
if (!this.name) {
2021-11-19 15:43:58 +00:00
this.$toast.error(this.$t("folder.invalid_name"))
2021-08-08 06:31:36 +00:00
return
}
this.$emit("submit", this.name)
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
},
},
2021-08-24 03:44:46 +00:00
})
</script>