From 0424d214c5eaaa7d2054f97a2663cccfcedcb76e Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Sat, 2 Sep 2017 18:08:32 +0200 Subject: [PATCH] Client Fixed (#9017) * fix spacing between rewards and items * fix rewards description * rewards cost in bold * fix gp notifications * fix dailies gray text * fix cancel in task edit modal * tags: use AND not OR for filtering * fix tasksDefaults so that monthlies can be created correctly * tags: usable if no task selected, saving checklist and tags saved the one being added without requiting to press enter * remove tags from tasks when they are deleted * fix tags removal when multiple tags are deleted and fix tags editing --- .../components/tasks/brokenTaskModal.vue | 2 +- website/client/components/tasks/column.vue | 23 +++++++++++----- website/client/components/tasks/task.vue | 9 +++---- website/client/components/tasks/taskModal.vue | 26 +++++++++---------- website/client/components/tasks/user.vue | 9 +++++-- website/client/mixins/notifications.js | 21 +++------------ website/client/store/actions/tasks.js | 4 +-- website/client/store/actions/user.js | 18 ++++++++++++- website/client/store/getters/tasks.js | 2 +- website/common/script/libs/taskDefaults.js | 12 +++++++-- website/server/controllers/api-v3/user.js | 26 ++++++++++++------- 11 files changed, 92 insertions(+), 60 deletions(-) diff --git a/website/client/components/tasks/brokenTaskModal.vue b/website/client/components/tasks/brokenTaskModal.vue index 5f66358c13..23d49bdc6b 100644 --- a/website/client/components/tasks/brokenTaskModal.vue +++ b/website/client/components/tasks/brokenTaskModal.vue @@ -54,7 +54,7 @@ export default { challengeId: this.brokenChallengeTask.challenge.id, keep: keepOption, }); - await this.$store.dispatch('tasks:fetchUserTasks', true); + await this.$store.dispatch('tasks:fetchUserTasks', {forceLoad: true}); this.close(); return; } diff --git a/website/client/components/tasks/column.vue b/website/client/components/tasks/column.vue index 0c7efce0c6..fdc1cc7139 100644 --- a/website/client/components/tasks/column.vue +++ b/website/client/components/tasks/column.vue @@ -18,7 +18,7 @@ @editTask="editTask", :group='group', ) - template(v-if="isUser === true && type === 'reward' && activeFilter.label !== 'custom'") + template(v-if="hasRewardsList") .reward-items shopItem( v-for="reward in inAppRewards", @@ -31,7 +31,7 @@ .column-background( v-if="isUser === true", - :class="{'initial-description': tasks[`${type}s`].length === 0}", + :class="{'initial-description': initialColumnDescription}", ref="columnBackground", ) .svg-icon(v-html="icons[type]", :class="`icon-${type}`", v-once) @@ -46,7 +46,7 @@ height: 556px; } - .task + .reward-items { + .task-wrapper + .reward-items { margin-top: 16px; } @@ -243,6 +243,17 @@ export default { inAppRewards () { return inAppRewards(this.user); }, + hasRewardsList () { + return this.isUser === true && this.type === 'reward' && this.activeFilter.label !== 'custom'; + }, + initialColumnDescription () { + // Show the column description in the middle only if there are no elements (tasks or in app items) + if (this.hasRewardsList) { + if (this.inAppRewards && this.inAppRewards.length >= 0) return false; + } + + return this.tasks[`${this.type}s`].length === 0; + }, }, watch: { taskList: { @@ -299,11 +310,11 @@ export default { const selectedTags = this.selectedTags; if (selectedTags && selectedTags.length > 0) { - const hasSelectedTag = task.tags.find(tagId => { - return selectedTags.indexOf(tagId) !== -1; + const hasAllSelectedTag = selectedTags.every(tagId => { + return task.tags.indexOf(tagId) !== -1; }); - if (!hasSelectedTag) return false; + if (!hasAllSelectedTag) return false; } // Text diff --git a/website/client/components/tasks/task.vue b/website/client/components/tasks/task.vue index 30c5134d4d..1db5f02e38 100644 --- a/website/client/components/tasks/task.vue +++ b/website/client/components/tasks/task.vue @@ -1,5 +1,5 @@