avatars now in a good looking way
Signed-off-by: Jakob <jakob.roehrl@web.de>
This commit is contained in:
133
src/components/cards/AvatarList.vue
Normal file
133
src/components/cards/AvatarList.vue
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
<!--
|
||||||
|
- @copyright Copyright (c) 2019 Julius Härtl <jus@bitgrid.net>
|
||||||
|
-
|
||||||
|
- @author Julius Härtl <jus@bitgrid.net>
|
||||||
|
-
|
||||||
|
- @license GNU AGPL version 3 or any later version
|
||||||
|
-
|
||||||
|
- This program is free software: you can redistribute it and/or modify
|
||||||
|
- it under the terms of the GNU Affero General Public License as
|
||||||
|
- published by the Free Software Foundation, either version 3 of the
|
||||||
|
- License, or (at your option) any later version.
|
||||||
|
-
|
||||||
|
- This program is distributed in the hope that it will be useful,
|
||||||
|
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
- GNU Affero General Public License for more details.
|
||||||
|
-
|
||||||
|
- You should have received a copy of the GNU Affero General Public License
|
||||||
|
- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-
|
||||||
|
-->
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="session-list">
|
||||||
|
<div class="avatar-list" @click="popoverVisible=!popoverVisible">
|
||||||
|
<div v-if="sessionsPopover.length > 0" class="avatardiv icon-more" />
|
||||||
|
<avatar v-for="session in sessionsVisible" :key="session.id"
|
||||||
|
:url="avatarUrl(session)" :disable-tooltip="true" :size="32" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-show="popoverVisible" class="popovermenu menu-right">
|
||||||
|
<popover-menu :menu="sessionsPopover" />
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Avatar from 'nextcloud-vue/dist/Components/Avatar'
|
||||||
|
import PopoverMenu from 'nextcloud-vue/dist/Components/PopoverMenu'
|
||||||
|
import Tooltip from 'nextcloud-vue/dist/Directives/Tooltip'
|
||||||
|
export default {
|
||||||
|
name: 'AvatarList',
|
||||||
|
components: {
|
||||||
|
Avatar,
|
||||||
|
PopoverMenu
|
||||||
|
},
|
||||||
|
directives: {
|
||||||
|
tooltip: Tooltip
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
sessions: {
|
||||||
|
type: Array,
|
||||||
|
default: () => { return {} }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
popoverVisible: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
sessionsVisible() {
|
||||||
|
return this.sessions.slice(0, 3)
|
||||||
|
},
|
||||||
|
avatarUrl() {
|
||||||
|
return (session) => {
|
||||||
|
const user = session.participant.displayname
|
||||||
|
const size = 32
|
||||||
|
const avatarUrl = OC.generateUrl('/avatar/{user}/{size}',
|
||||||
|
{
|
||||||
|
user: user,
|
||||||
|
size: size
|
||||||
|
})
|
||||||
|
return window.location.protocol + '//' + window.location.host + avatarUrl
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sessionsPopover() {
|
||||||
|
return [
|
||||||
|
...this.sessions.slice(3).map((session) => {
|
||||||
|
return {
|
||||||
|
href: '#',
|
||||||
|
icon: this.avatarUrl(session),
|
||||||
|
text: session.participant.displayname
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.session-list {
|
||||||
|
position: relative;
|
||||||
|
flex-grow: 1;
|
||||||
|
/deep/ .popovermenu {
|
||||||
|
margin-right: -4px;
|
||||||
|
img {
|
||||||
|
padding: 0;
|
||||||
|
width: 32px !important;
|
||||||
|
height: 32px !important;
|
||||||
|
margin: 6px;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.avatar-list {
|
||||||
|
float: right;
|
||||||
|
display: inline-flex;
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
.avatardiv,
|
||||||
|
/deep/ .avatardiv {
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
margin-right: -8px;
|
||||||
|
border: 2px solid var(--color-main-background);
|
||||||
|
background-color: var(--color-main-background) !important;
|
||||||
|
box-sizing: content-box !important;
|
||||||
|
&.icon-more {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
opacity: .5;
|
||||||
|
background-color: var(--color-background-dark) !important;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.popovermenu {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -36,17 +36,16 @@ cardbadges
|
|||||||
|
|
||||||
<div v-if="card.attachments" class="card-files icon icon-files-dark" />
|
<div v-if="card.attachments" class="card-files icon icon-files-dark" />
|
||||||
|
|
||||||
<div v-if="card.assignedUsers" class="card-assigned-users">
|
<avatar-list :sessions="card.assignedUsers" />
|
||||||
<avatar v-for="user in card.assignedUsers" :key="user.id" :user="user.participant.primaryKey" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { Avatar } from 'nextcloud-vue'
|
import { Avatar } from 'nextcloud-vue'
|
||||||
|
import AvatarList from './AvatarList'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CardBadges',
|
name: 'CardBadges',
|
||||||
components: { Avatar },
|
components: { Avatar, AvatarList },
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|||||||
Reference in New Issue
Block a user