label multi shows color, sharing shows avatars (#1210)

label multi shows color, sharing shows avatars
This commit is contained in:
Julius Härtl
2019-08-30 15:55:31 +02:00
committed by GitHub
2 changed files with 42 additions and 10 deletions

View File

@@ -1,11 +1,13 @@
<template> <template>
<div> <div>
<multiselect v-model="addAcl" :options="unallocatedSharees" label="label" <multiselect
@input="clickAddAcl" @search-change="asyncFind"> v-model="addAcl"
<template #option="scope"> :options="formatedSharees"
{{ scope.option.label }} :user-select="true"
</template> label="displayName"
</multiselect> track-by="user"
@input="clickAddAcl"
@search-change="asyncFind" />
<ul <ul
id="shareWithList" id="shareWithList"
@@ -71,6 +73,27 @@ export default {
...mapGetters({ ...mapGetters({
sharees: 'sharees' sharees: 'sharees'
}), }),
formatedSharees() {
return this.unallocatedSharees.map(item => {
let sharee = {
user: item.label,
displayName: item.label,
icon: 'icon-user'
}
if (item.value.shareType === 1) {
sharee.icon = 'icon-group'
sharee.isNoUser = true
}
if (item.value.shareType === 7) {
sharee.icon = 'icon-circle'
sharee.isNoUser = true
}
return sharee
})
},
unallocatedSharees() { unallocatedSharees() {
return this.sharees.filter((sharee) => { return this.sharees.filter((sharee) => {
return Object.values(this.board.acl).findIndex((acl) => { return Object.values(this.board.acl).findIndex((acl) => {
@@ -129,4 +152,7 @@ export default {
padding: 12px 9px; padding: 12px 9px;
flex-grow: 1; flex-grow: 1;
} }
.avatarLabel {
padding: 6px
}
</style> </style>

View File

@@ -36,7 +36,7 @@
:taggable="true" label="title" :taggable="true" label="title"
track-by="id" @select="addLabelToCard" @remove="removeLabelFromCard"> track-by="id" @select="addLabelToCard" @remove="removeLabelFromCard">
<template #option="scope"> <template #option="scope">
<span>{{ scope.option.title }}</span> <div :style="{ color: '#' + scope.option.color}">{{ scope.option.title }}</div>
</template> </template>
</multiselect> </multiselect>
</div> </div>
@@ -50,7 +50,8 @@
track-by="primaryKey" track-by="primaryKey"
@select="assignUserToCard" @remove="removeUserFromCard"> @select="assignUserToCard" @remove="removeUserFromCard">
<template #option="scope"> <template #option="scope">
{{ scope.option.displayname }} <avatar :user="scope.option.primaryKey" />
<span class="avatarLabel">{{ scope.option.displayname }} </span>
</template> </template>
</multiselect> </multiselect>
</div> </div>
@@ -86,7 +87,7 @@
</template> </template>
<script> <script>
import { AppSidebar, AppSidebarTab, Multiselect, DatetimePicker } from 'nextcloud-vue' import { AppSidebar, AppSidebarTab, Multiselect, DatetimePicker, Avatar } from 'nextcloud-vue'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import VueEasymde from 'vue-easymde' import VueEasymde from 'vue-easymde'
import { Actions } from 'nextcloud-vue/dist/Components/Actions' import { Actions } from 'nextcloud-vue/dist/Components/Actions'
@@ -103,7 +104,8 @@ export default {
DatetimePicker, DatetimePicker,
VueEasymde, VueEasymde,
Actions, Actions,
ActionButton ActionButton,
Avatar
}, },
props: { props: {
id: { id: {
@@ -317,4 +319,8 @@ export default {
} }
} }
.avatarLabel {
padding: 6px
}
</style> </style>