Misc fixes (#9215)

* quick add assign tags

* fix columns descriptions

* fix changing language not taking effect immediately
This commit is contained in:
Matteo Pagliazzi
2017-10-17 23:38:42 +02:00
committed by GitHub
parent ad50f90ba0
commit c8625cb23f
2 changed files with 17 additions and 14 deletions

View File

@@ -280,7 +280,7 @@ export default {
} else { } else {
settings[`preferences.${preferenceType}.${subtype}`] = this.user.preferences[preferenceType][subtype]; settings[`preferences.${preferenceType}.${subtype}`] = this.user.preferences[preferenceType][subtype];
} }
this.$store.dispatch('user:set', settings); return this.$store.dispatch('user:set', settings);
}, },
hideHeader () { hideHeader () {
this.set('hideHeader'); this.set('hideHeader');
@@ -338,10 +338,10 @@ export default {
// @TODO // @TODO
// Notification.text(response.data.data.message); // Notification.text(response.data.data.message);
}, },
changeLanguage (e) { async changeLanguage (e) {
const newLang = e.target.value; const newLang = e.target.value;
this.user.preferences.language = newLang; this.user.preferences.language = newLang;
this.set('language'); await this.set('language');
window.location.href = '/'; window.location.href = '/';
}, },
async changeUser (attribute, updates) { async changeUser (attribute, updates) {

View File

@@ -9,12 +9,13 @@
:class="{active: activeFilters[type].label === filter.label}", :class="{active: activeFilters[type].label === filter.label}",
@click="activateFilter(type, filter)", @click="activateFilter(type, filter)",
) {{ $t(filter.label) }} ) {{ $t(filter.label) }}
.tasks-list .tasks-list(ref="tasksWrapper")
input.quick-add( input.quick-add(
v-if="isUser", :placeholder="quickAddPlaceholder", v-if="isUser", :placeholder="quickAddPlaceholder",
v-model="quickAddText", @keyup.enter="quickAdd", 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( task(
v-for="task in taskList", v-for="task in taskList",
:key="task.id", :task="task", :key="task.id", :task="task",
@@ -380,6 +381,7 @@ export default {
}, },
quickAdd () { quickAdd () {
const task = taskDefaults({type: this.type, text: this.quickAddText}); const task = taskDefaults({type: this.type, text: this.quickAddText});
task.tags = this.selectedTags;
this.quickAddText = null; this.quickAddText = null;
this.createTask(task); this.createTask(task);
}, },
@@ -398,23 +400,24 @@ export default {
}, },
setColumnBackgroundVisibility () { setColumnBackgroundVisibility () {
this.$nextTick(() => { 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; 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) { if (rewardsList) {
combinedTasksHeights += rewardsList.offsetHeight; combinedTasksHeights += rewardsList.offsetHeight;
} }
const columnBackgroundStyle = this.$refs.columnBackground.style; const columnBackgroundStyle = this.$refs.columnBackground.style;
if (tasklistHeight - combinedTasksHeights < 150) { if (tasksWrapperHeight - combinedTasksHeights < 150) {
columnBackgroundStyle.display = 'none'; columnBackgroundStyle.display = 'none';
} else { } else {
columnBackgroundStyle.display = 'block'; columnBackgroundStyle.display = 'block';