feat: directly create a new task from relations when none was selected

This commit is contained in:
kolaente 2022-04-02 13:54:45 +02:00
parent ad8ca462cb
commit dfed1f438a
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
3 changed files with 14 additions and 2 deletions

View file

@ -83,7 +83,8 @@
<span class="title">{{ rts.title }}</span>
<div class="tasks">
<div :key="t.id" class="task" v-for="t in rts.tasks">
<router-link :to="{ name: $route.name, params: { id: t.id } }" :class="{ 'is-strikethrough': t.done}">
<router-link :to="{ name: $route.name, params: { id: t.id } }"
:class="{ 'is-strikethrough': t.done}">
<span
class="different-list"
v-if="t.listId !== listId"
@ -156,6 +157,7 @@ export default {
relationToDelete: {},
saved: false,
showNewRelationForm: false,
query: '',
}
},
components: {
@ -211,10 +213,20 @@ export default {
},
methods: {
async findTasks(query) {
this.query = query
this.foundTasks = await this.taskService.getAll({}, {s: query})
},
async addTaskRelation() {
if (this.newTaskRelationTask.id === 0 && this.query !== '') {
return this.createAndRelateTask(this.query)
}
if (this.newTaskRelationTask.id === 0) {
this.$message.error({message: this.$t('task.relation.taskRequired')})
return
}
const rel = new TaskRelationModel({
taskId: this.taskId,
otherTaskId: this.newTaskRelationTask.id,

View file

@ -737,6 +737,7 @@
"deleteText1": "Are you sure you want to delete this task relation?",
"deleteText2": "This cannot be undone!",
"select": "Select a relation kind",
"taskRequired": "Please select a task or enter a new task title.",
"kinds": {
"subtask": "Subtask | Subtasks",
"parenttask": "Parent Task | Parent Tasks",

View file

@ -35,7 +35,6 @@ export function error(e, actions = []) {
text: getErrorText(e),
actions: actions,
})
console.error(e, actions)
}
export function success(e, actions = []) {