Add removing of tasks (#48)

Add removing of tasks

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/48
This commit is contained in:
konrad 2020-01-22 20:18:39 +00:00
parent ed0ae210ac
commit 22d2d1a777
2 changed files with 32 additions and 0 deletions

View file

@ -236,11 +236,27 @@
<span class="icon is-small"><icon :icon="['far', 'clock']"/></span> <span class="icon is-small"><icon :icon="['far', 'clock']"/></span>
Set a repeating interval Set a repeating interval
</a> </a>
<a class="button is-danger is-outlined noshadow has-no-border" @click="showDeleteModal = true">
<span class="icon is-small"><icon icon="trash-alt"/></span>
Delete task
</a>
</div> </div>
</div> </div>
<!-- Created / Updated [by] --> <!-- Created / Updated [by] -->
</div> </div>
<modal
v-if="showDeleteModal"
@close="showDeleteModal = false"
@submit="deleteTask()">
<span slot="header">Delete this task</span>
<p slot="text">
Are you sure you want to remove this task? <br/>
This will also remove all attachments, reminders and relations associated with this task and
<b>cannot be undone!</b>
</p>
</modal>
</div> </div>
</template> </template>
@ -264,6 +280,7 @@
import RelatedTasks from './reusable/relatedTasks' import RelatedTasks from './reusable/relatedTasks'
import RepeatAfter from './reusable/repeatAfter' import RepeatAfter from './reusable/repeatAfter'
import Reminders from './reusable/reminders' import Reminders from './reusable/reminders'
import router from '../../router'
export default { export default {
name: 'TaskDetailView', name: 'TaskDetailView',
@ -287,6 +304,7 @@
list: ListModel, list: ListModel,
namespace: NamespaceModel, namespace: NamespaceModel,
showDeleteModal: false,
priorities: priorites, priorities: priorites,
flatPickerConfig: { flatPickerConfig: {
@ -372,6 +390,16 @@
this.activeFields[fieldName] = true this.activeFields[fieldName] = true
this.$nextTick(() => this.$refs[fieldName].$el.focus()) this.$nextTick(() => this.$refs[fieldName].$el.focus())
}, },
deleteTask() {
this.taskService.delete(this.task)
.then(() => {
message.success({message: 'The task been deleted successfully.'}, this)
router.push({name: 'showList', params: {id: this.list.id}})
})
.catch(e => {
message.error(e, this)
})
},
}, },
} }
</script> </script>

View file

@ -27,3 +27,7 @@ h1,h2,h3,h4,h5,h6{
.progress { .progress {
border-radius: $radius-large; border-radius: $radius-large;
} }
.has-no-border{
border: none !important;
}