feat: directly create a new task from relations when none was selected
This commit is contained in:
parent
ad8ca462cb
commit
dfed1f438a
3 changed files with 14 additions and 2 deletions
|
@ -83,7 +83,8 @@
|
||||||
<span class="title">{{ rts.title }}</span>
|
<span class="title">{{ rts.title }}</span>
|
||||||
<div class="tasks">
|
<div class="tasks">
|
||||||
<div :key="t.id" class="task" v-for="t in rts.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
|
<span
|
||||||
class="different-list"
|
class="different-list"
|
||||||
v-if="t.listId !== listId"
|
v-if="t.listId !== listId"
|
||||||
|
@ -156,6 +157,7 @@ export default {
|
||||||
relationToDelete: {},
|
relationToDelete: {},
|
||||||
saved: false,
|
saved: false,
|
||||||
showNewRelationForm: false,
|
showNewRelationForm: false,
|
||||||
|
query: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
@ -211,10 +213,20 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async findTasks(query) {
|
async findTasks(query) {
|
||||||
|
this.query = query
|
||||||
this.foundTasks = await this.taskService.getAll({}, {s: query})
|
this.foundTasks = await this.taskService.getAll({}, {s: query})
|
||||||
},
|
},
|
||||||
|
|
||||||
async addTaskRelation() {
|
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({
|
const rel = new TaskRelationModel({
|
||||||
taskId: this.taskId,
|
taskId: this.taskId,
|
||||||
otherTaskId: this.newTaskRelationTask.id,
|
otherTaskId: this.newTaskRelationTask.id,
|
||||||
|
|
|
@ -737,6 +737,7 @@
|
||||||
"deleteText1": "Are you sure you want to delete this task relation?",
|
"deleteText1": "Are you sure you want to delete this task relation?",
|
||||||
"deleteText2": "This cannot be undone!",
|
"deleteText2": "This cannot be undone!",
|
||||||
"select": "Select a relation kind",
|
"select": "Select a relation kind",
|
||||||
|
"taskRequired": "Please select a task or enter a new task title.",
|
||||||
"kinds": {
|
"kinds": {
|
||||||
"subtask": "Subtask | Subtasks",
|
"subtask": "Subtask | Subtasks",
|
||||||
"parenttask": "Parent Task | Parent Tasks",
|
"parenttask": "Parent Task | Parent Tasks",
|
||||||
|
|
|
@ -35,7 +35,6 @@ export function error(e, actions = []) {
|
||||||
text: getErrorText(e),
|
text: getErrorText(e),
|
||||||
actions: actions,
|
actions: actions,
|
||||||
})
|
})
|
||||||
console.error(e, actions)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function success(e, actions = []) {
|
export function success(e, actions = []) {
|
||||||
|
|
Loading…
Reference in a new issue