Merge pull request #1868 from nextcloud/bugfix/1819/include_self_added_categories_in_list

Show self-added categories in list, making it easier to remove them
This commit is contained in:
Georg Ehrke 2020-01-20 18:14:01 +01:00 committed by GitHub
commit 78cc716d95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 4 deletions

View File

@ -95,7 +95,17 @@ export default {
return !(this.isReadOnly && this.value.length === 0)
},
options() {
return this.propModel.options.slice().sort((a, b) => a.localeCompare(b, getLocale().replace('_', '-'), { sensitivity: 'base' }))
const options = this.propModel.options.slice()
for (const value of (this.value || [])) {
if (options.includes(value)) {
continue
}
options.push(value)
}
return options
.sort((a, b) => a.localeCompare(b, getLocale().replace('_', '-'), { sensitivity: 'base' }))
},
},
methods: {

View File

@ -23,7 +23,7 @@
<template>
<span class="property-select-multiple-colored-tag">
<div class="property-select-multiple-colored-tag__color-indicator" :style="{ 'background-color': color}" />
<span class="property-select-multiple-colored-tag__label">{{ option }}</span>
<span class="property-select-multiple-colored-tag__label">{{ label }}</span>
</span>
</template>
@ -34,13 +34,20 @@ export default {
name: 'PropertySelectMultipleColoredOption',
props: {
option: {
type: String,
type: [String, Object],
required: true,
},
},
computed: {
label() {
if (typeof this.option === 'string') {
return this.option
}
return this.option.label
},
colorObject() {
return uidToColor(this.option)
return uidToColor(this.label)
},
color() {
const color = this.colorObject