From c8625cb23fbd58681136045fe16b75bb05be436b Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Tue, 17 Oct 2017 23:38:42 +0200 Subject: [PATCH] Misc fixes (#9215) * quick add assign tags * fix columns descriptions * fix changing language not taking effect immediately --- website/client/components/settings/site.vue | 6 ++--- website/client/components/tasks/column.vue | 25 ++++++++++++--------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/website/client/components/settings/site.vue b/website/client/components/settings/site.vue index b94527b153..b22b627844 100644 --- a/website/client/components/settings/site.vue +++ b/website/client/components/settings/site.vue @@ -280,7 +280,7 @@ export default { } else { settings[`preferences.${preferenceType}.${subtype}`] = this.user.preferences[preferenceType][subtype]; } - this.$store.dispatch('user:set', settings); + return this.$store.dispatch('user:set', settings); }, hideHeader () { this.set('hideHeader'); @@ -338,10 +338,10 @@ export default { // @TODO // Notification.text(response.data.data.message); }, - changeLanguage (e) { + async changeLanguage (e) { const newLang = e.target.value; this.user.preferences.language = newLang; - this.set('language'); + await this.set('language'); window.location.href = '/'; }, async changeUser (attribute, updates) { diff --git a/website/client/components/tasks/column.vue b/website/client/components/tasks/column.vue index d78617b8f8..263d71af6d 100644 --- a/website/client/components/tasks/column.vue +++ b/website/client/components/tasks/column.vue @@ -9,12 +9,13 @@ :class="{active: activeFilters[type].label === filter.label}", @click="activateFilter(type, filter)", ) {{ $t(filter.label) }} - .tasks-list + .tasks-list(ref="tasksWrapper") input.quick-add( v-if="isUser", :placeholder="quickAddPlaceholder", v-model="quickAddText", @keyup.enter="quickAdd", + ref="quickAdd", ) - .sortable-tasks(ref="taskList", v-sortable='', @onsort='sorted') + .sortable-tasks(ref="tasksList", v-sortable='', @onsort='sorted') task( v-for="task in taskList", :key="task.id", :task="task", @@ -380,6 +381,7 @@ export default { }, quickAdd () { const task = taskDefaults({type: this.type, text: this.quickAddText}); + task.tags = this.selectedTags; this.quickAddText = null; this.createTask(task); }, @@ -398,23 +400,24 @@ export default { }, setColumnBackgroundVisibility () { this.$nextTick(() => { - const taskListEl = this.$refs.taskList; - const tasklistHeight = taskListEl.offsetHeight; - let combinedTasksHeights = 0; - Array.from(taskListEl.getElementsByClassName('task')).forEach(el => { - combinedTasksHeights += el.offsetHeight; - }); - if (!this.$refs.columnBackground) return; - const rewardsList = taskListEl.getElementsByClassName('reward-items')[0]; + const tasksWrapperEl = this.$refs.tasksWrapper; + + const tasksWrapperHeight = tasksWrapperEl.offsetHeight; + const quickAddHeight = this.$refs.quickAdd ? this.$refs.quickAdd.offsetHeight : 0; + const tasksListHeight = this.$refs.tasksList.offsetHeight; + + let combinedTasksHeights = tasksListHeight + quickAddHeight; + + const rewardsList = tasksWrapperEl.getElementsByClassName('reward-items')[0]; if (rewardsList) { combinedTasksHeights += rewardsList.offsetHeight; } const columnBackgroundStyle = this.$refs.columnBackground.style; - if (tasklistHeight - combinedTasksHeights < 150) { + if (tasksWrapperHeight - combinedTasksHeights < 150) { columnBackgroundStyle.display = 'none'; } else { columnBackgroundStyle.display = 'block';