Cleanup list edit

This commit is contained in:
kolaente 2021-01-24 22:05:37 +01:00
parent 27d189ceb3
commit 060cc3a1f8
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 78 additions and 94 deletions

View File

@ -31,8 +31,8 @@
<x-button <x-button
:shadow="false" :shadow="false"
type="primary" type="primary"
@click.prevent.stop="$emit('create')" @click.prevent.stop="primary"
icon="plus" :icon="primaryIcon"
:disabled="primaryDisabled" :disabled="primaryDisabled"
> >
{{ primaryLabel }} {{ primaryLabel }}
@ -54,6 +54,10 @@ export default {
type: String, type: String,
default: 'Create', default: 'Create',
}, },
primaryIcon: {
type: String,
default: 'plus',
},
primaryDisabled: { primaryDisabled: {
type: Boolean, type: Boolean,
default: false, default: false,
@ -63,5 +67,11 @@ export default {
default: '', default: '',
}, },
}, },
methods: {
primary() {
this.$emit('create')
this.$emit('primary')
},
},
} }
</script> </script>

View File

@ -1,9 +0,0 @@
<template>
</template>
<script>
export default {
name: 'list-setting-background'
}
</script>

View File

@ -1,98 +1,81 @@
<template> <template>
<create-edit <create-edit
title="Edit List" title="Edit List"
primary-icon=""
primary-label="Save" primary-label="Save"
@primary="save"
tertary="Delete"
@tertary="showDeleteModal = true"
> >
<form @submit.prevent="submit()"> <div class="field">
<div class="field"> <label class="label" for="listtext">List Name</label>
<label class="label" for="listtext">List Name</label>
<div class="control">
<input
:class="{ 'disabled': listService.loading}"
:disabled="listService.loading"
@keyup.enter="submit"
class="input"
id="listtext"
placeholder="The list title goes here..."
type="text"
v-focus
v-model="list.title"/>
</div>
</div>
<div class="field">
<label
class="label"
for="listtext"
v-tooltip="'The list identifier can be used to uniquely identify a task across lists. You can set it to empty to disable it.'">
List Identifier
</label>
<div class="control">
<input
:class="{ 'disabled': listService.loading}"
:disabled="listService.loading"
@keyup.enter="submit"
class="input"
id="listtext"
placeholder="The list identifier goes here..."
type="text"
v-focus
v-model="list.identifier"/>
</div>
</div>
<div class="field">
<label class="label" for="listdescription">Description</label>
<div class="control">
<editor
:class="{ 'disabled': listService.loading}"
:disabled="listService.loading"
:preview-is-default="false"
id="listdescription"
placeholder="The lists description goes here..."
v-model="list.description"
/>
</div>
</div>
<div class="field">
<label class="label" for="isArchivedCheck">Is Archived</label>
<div class="control">
<fancycheckbox
v-model="list.isArchived"
v-tooltip="'If a list is archived, you cannot create new tasks or edit the list or existing tasks.'">
This list is archived
</fancycheckbox>
</div>
</div>
<div class="field">
<label class="label">Color</label>
<div class="control">
<color-picker v-model="list.hexColor"/>
</div>
</div>
</form>
<div class="field has-addons mt-4">
<div class="control is-fullwidth">
<x-button
@click="submit()"
:loading="listService.loading"
class="is-fullwidth">
Save
</x-button>
</div>
<div class="control"> <div class="control">
<x-button <input
@click="showDeleteModal = true" :class="{ 'disabled': listService.loading}"
:locading="listService.loading" :disabled="listService.loading"
icon="trash-alt" @keyup.enter="save"
class="is-danger" class="input"
id="listtext"
placeholder="The list title goes here..."
type="text"
v-focus
v-model="list.title"/>
</div>
</div>
<div class="field">
<label
class="label"
for="listtext"
v-tooltip="'The list identifier can be used to uniquely identify a task across lists. You can set it to empty to disable it.'">
List Identifier
</label>
<div class="control">
<input
:class="{ 'disabled': listService.loading}"
:disabled="listService.loading"
@keyup.enter="save"
class="input"
id="listtext"
placeholder="The list identifier goes here..."
type="text"
v-focus
v-model="list.identifier"/>
</div>
</div>
<div class="field">
<label class="label" for="listdescription">Description</label>
<div class="control">
<editor
:class="{ 'disabled': listService.loading}"
:disabled="listService.loading"
:preview-is-default="false"
id="listdescription"
placeholder="The lists description goes here..."
v-model="list.description"
/> />
</div> </div>
</div> </div>
<div class="field">
<label class="label" for="isArchivedCheck">Is Archived</label>
<div class="control">
<fancycheckbox
v-model="list.isArchived"
v-tooltip="'If a list is archived, you cannot create new tasks or edit the list or existing tasks.'">
This list is archived
</fancycheckbox>
</div>
</div>
<div class="field">
<label class="label">Color</label>
<div class="control">
<color-picker v-model="list.hexColor"/>
</div>
</div>
<transition name="modal"> <transition name="modal">
<modal <modal
@close="showDeleteModal = false" @close="showDeleteModal = false"
@submit="deleteList()" @save="deleteList()"
v-if="showDeleteModal"> v-if="showDeleteModal">
<span slot="header">Delete the list</span> <span slot="header">Delete the list</span>
<p slot="text">Are you sure you want to delete this list and all of its contents? <p slot="text">Are you sure you want to delete this list and all of its contents?
@ -164,7 +147,7 @@ export default {
this.error(e, this) this.error(e, this)
}) })
}, },
submit() { save() {
this.listService.update(this.list) this.listService.update(this.list)
.then(r => { .then(r => {
this.$store.commit('namespaces/setListInNamespaceById', r) this.$store.commit('namespaces/setListInNamespaceById', r)