diff --git a/website/client/components/tasks/tagsPopup.vue b/website/client/components/tasks/tagsPopup.vue new file mode 100644 index 0000000000..c748696081 --- /dev/null +++ b/website/client/components/tasks/tagsPopup.vue @@ -0,0 +1,107 @@ + + + + + diff --git a/website/client/components/tasks/taskModal.vue b/website/client/components/tasks/taskModal.vue index 3e9ac99fde..c80b6bc203 100644 --- a/website/client/components/tasks/taskModal.vue +++ b/website/client/components/tasks/taskModal.vue @@ -110,29 +110,22 @@ span.custom-control-indicator span.custom-control-description {{ $t('dayOfWeek') }} - .option(v-if="isUserTask") - label(v-once) {{ $t('tags') }} - .category-wrap(@click="showTagsSelect = !showTagsSelect") - span.category-select(v-if='task.tags && task.tags.length === 0') {{$t('none')}} - span.category-select(v-else) - .category-label(v-for='tagName in getTagsFor(task)') {{tagName}} - .category-box(v-if="showTagsSelect") - .container - .row - .form-check.col-6( - v-for="tag in user.tags", - :key="tag.id", - ) - label.custom-control.custom-checkbox - input.custom-control-input(type="checkbox", :value="tag.id", v-model="task.tags") - span.custom-control-indicator - span.custom-control-description(v-once) {{ tag.name }} - .row - button.btn.btn-primary(@click="showTagsSelect = !showTagsSelect") {{$t('close')}} + .tags-select.option(v-if="isUserTask") + .tags-inline + label(v-once) {{ $t('tags') }} + .category-wrap(@click="showTagsSelect = !showTagsSelect", v-bind:class="{ active: showTagsSelect }") + span.category-select(v-if='task.tags && task.tags.length === 0') + .tags-none {{$t('none')}} + .dropdown-toggle + span.category-select(v-else) + .category-label(v-for='tagName in truncatedSelectedTags', :title="tagName") {{ tagName }} + .tags-more(v-if='remainingSelectedTags.length > 0') +{{ $t('more', { count: remainingSelectedTags.length }) }} + .dropdown-toggle + tags-popup(v-if="showTagsSelect", :tags="user.tags", v-model="task.tags") .option(v-if="task.type === 'habit'") label(v-once) {{ $t('resetStreak') }} - b-dropdown(:text="$t(task.frequency)") + b-dropdown.streak-dropdown(:text="$t(task.frequency)") b-dropdown-item(v-for="frequency in ['daily', 'weekly', 'monthly']", :key="frequency", @click="task.frequency = frequency", :class="{active: task.frequency === frequency}") | {{ $t(frequency) }} @@ -328,6 +321,88 @@ } } + .tags-select { + position: relative; + + .tags-inline { + align-items: center; + display: flex; + justify-content: flex-start; + + label { + margin: 0; + } + + .category-wrap { + cursor: inherit; + position: relative; + border: 1px solid transparent; + border-radius: 2px; + margin-left: 4em; + + &.active { + border-color: $purple-500; + + .category-select { + box-shadow: none; + } + } + + .category-select { + align-items: center; + display: flex; + padding: .6em; + padding-right: 2.8em; + width: 100%; + + .tags-none { + margin: .26em 0 .26em .6em; + + & + .dropdown-toggle { + right: 1.3em; + } + } + + .tags-more { + color: #a5a1ac; + flex: 0 1 auto; + font-size: 12px; + text-align: left; + position: relative; + left: .5em; + width: 100%; + } + + .dropdown-toggle { + position: absolute; + right: 1em; + top: .8em; + } + + .category-label { + min-width: 68px; + overflow: hidden; + padding: .5em 1em; + text-overflow: ellipsis; + white-space: nowrap; + width: 68px; + word-wrap: break-word; + } + } + } + } + + .tags-popup { + position: absolute; + top: 3.5em; + left: 6.2em; + } + } + + .streak-dropdown { + margin-left: .5em; + } + .checklist-group { border-top: 1px solid $gray-500; } @@ -418,6 +493,7 @@