Skip to content

Commit

Permalink
Merge pull request #5285 from nextcloud/bugfix/5283
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusknorr authored Nov 13, 2023
2 parents bb51988 + 488cdbc commit 54ff02b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
3 changes: 2 additions & 1 deletion src/components/card/CardSidebarTabDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,14 @@ export default {
},
async addLabelToBoardAndCard(name) {
await this.$store.dispatch('addLabelToCurrentBoardAndCard', {
const newLabel = await this.$store.dispatch('addLabelToCurrentBoardAndCard', {
card: this.copiedCard,
newLabel: {
title: name,
color: this.randomColor(),
},
})
this.copiedCard.labels.push(newLabel)
},
removeLabelFromCard(removedLabel) {
Expand Down
29 changes: 9 additions & 20 deletions src/components/card/TagSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@
:taggable="true"
label="title"
track-by="id"
tag-position="bottom"
@select="onSelect"
@remove="onRemove"
@tag="onNewTag">
<template #option="scope">
<div :style="{ backgroundColor: '#' + scope.option.color, color: textColor(scope.option.color)}" class="tag">
<div v-if="!scope.option?.isTag" :style="{ backgroundColor: '#' + scope.option.color, color: textColor(scope.option.color)}" class="tag">
{{ scope.option.title }}
</div>
<div v-else>
{{ t('deck', 'Create a new tag:') }} <div class="tag">
{{ scope.option.label }}
</div>
</div>
</template>
<template #tag="scope">
<div :style="{ backgroundColor: '#' + scope.option.color, color: textColor(scope.option.color)}" class="tag">
Expand Down Expand Up @@ -52,32 +58,15 @@ export default {
default: false,
},
},
data() {
return {
assignedLabels: null,
}
},
computed: {
labelsSorted() {
return [...this.labels].sort((a, b) => (a.title < b.title) ? -1 : 1)
},
},
watch: {
card() {
this.initialize()
assignedLabels() {
return [...this.card.labels].local((a, b) => (a.title < b.title) ? -1 : 1)
},
},
mounted() {
this.initialize()
},
methods: {
async initialize() {
if (!this.card) {
return
}
this.assignedLabels = [...this.card.labels].sort((a, b) => (a.title < b.title) ? -1 : 1)
},
onSelect(newLabel) {
this.$emit('select', newLabel)
},
Expand Down
2 changes: 1 addition & 1 deletion src/mixins/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import chroma from 'chroma-js'
export default {
methods: {
textColor(hex) {
return chroma(hex).get('lab.l') > 50 ? '#000000' : '#ffffff'
return chroma(hex ?? 'ffffff').get('lab.l') > 50 ? '#000000' : '#ffffff'
},
colorIsValid(hex) {
const re = /[A-Fa-f0-9]{6}/
Expand Down

0 comments on commit 54ff02b

Please sign in to comment.