From 2387cdc09822ae4ab477c6ce592f873b6e1cd5be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?= Date: Tue, 6 Aug 2019 20:46:58 +0200 Subject: [PATCH] =?UTF-8?q?Allow=20to=20drop=20tasks=20onto=20collections?= =?UTF-8?q?=20in=20left=20sidebar=20Signed-off-by:=20Raimund=20Schl=C3=BC?= =?UTF-8?q?=C3=9Fler=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/src/style.scss | 6 ++-- src/components/TaskDragContainer.vue | 41 ++-------------------------- src/components/TheList.vue | 34 +++++++++++++++++++---- src/store/tasks.js | 38 ++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 45 deletions(-) diff --git a/css/src/style.scss b/css/src/style.scss index 6f8881d4..841a37ff 100644 --- a/css/src/style.scss +++ b/css/src/style.scss @@ -54,8 +54,10 @@ } } - &.list .task-item { - display: none; + &.list, &.collection { + .task-item { + display: none; + } } .app-navigation-entry-edit { diff --git a/src/components/TaskDragContainer.vue b/src/components/TaskDragContainer.vue index afb2b2e7..3055274f 100644 --- a/src/components/TaskDragContainer.vue +++ b/src/components/TaskDragContainer.vue @@ -54,8 +54,7 @@ export default { 'moveTask', 'setPriority', 'setPercentComplete', - 'setDue', - 'setStart', + 'setDate', ]), /** @@ -131,48 +130,14 @@ export default { } break case 'today': - this.setDate(task, 0) + this.setDate({ task: task, day: 0 }) break case 'week': - this.setDate(task, collectionId[1]) + this.setDate({ task: task, day: collectionId[1] }) break } } }, - - /** - * Sets the start or due date to the given day - * - * @param {Task} task The task to change - * @param {Integer} day The day to set - */ - setDate: function(task, day) { - var start = moment(task.start, 'YYYYMMDDTHHmmss').startOf('day') - var due = moment(task.due, 'YYYYMMDDTHHmmss').startOf('day') - day = moment().startOf('day').add(day, 'days') - - var diff - // Adjust start date - if (start.isValid()) { - diff = start.diff(moment().startOf('day'), 'days') - diff = diff < 0 ? 0 : diff - if (diff !== day) { - var newStart = moment(task.start, 'YYYYMMDDTHHmmss').year(day.year()).month(day.month()).date(day.date()) - this.setStart({ task: task, start: newStart }) - } - // Adjust due date - } else if (due.isValid()) { - diff = due.diff(moment().startOf('day'), 'days') - diff = diff < 0 ? 0 : diff - if (diff !== day) { - var newDue = moment(task.due, 'YYYYMMDDTHHmmss').year(day.year()).month(day.month()).date(day.date()) - this.setDue({ task: task, due: newDue }) - } - // Set the due date to appropriate value - } else { - this.setDue({ task: task, due: day }) - } - }, }, } diff --git a/src/components/TheList.vue b/src/components/TheList.vue index 30de2fbb..df5a7cac 100644 --- a/src/components/TheList.vue +++ b/src/components/TheList.vue @@ -21,15 +21,15 @@ License along with this library. If not, see .