From 0f0891931857a00268bc1e7ec8c95199a97df64a Mon Sep 17 00:00:00 2001 From: stingl Date: Mon, 8 Aug 2022 11:54:39 +0200 Subject: [PATCH] automatically create multiple tasks if seperated by semicolons; --- src/views/TasksForTracker.vue | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/views/TasksForTracker.vue b/src/views/TasksForTracker.vue index 85ae422..5c25e3b 100644 --- a/src/views/TasksForTracker.vue +++ b/src/views/TasksForTracker.vue @@ -83,13 +83,23 @@ export default { this.$store.state.selectedTracker.tasks = []; } - this.$store.state.selectedTracker.tasks.pushToBeginning({ - name: this.newTaskInput, - done: false, - created: moment(), - percentDone: 0, - finished: null - }); + let newTasks = [this.newTaskInput]; + + if (this.newTaskInput.split(';') > 3) { + newTasks = this.newTaskInput.split(';').reverse().map((task) => { + return task.trim(); + }) + } + + newTasks.forEach((task) => { + this.$store.state.selectedTracker.tasks.pushToBeginning({ + name: task, + done: false, + created: moment(), + percentDone: 0, + finished: null + }); + }) this.newTaskInput = ''; this.$store.commit('saveTrackers');