Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix avatar display on read-only contacts and use global Avatar component #1846

Merged
merged 1 commit into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 104 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@
"@nextcloud/l10n": "^1.4.1",
"@nextcloud/paths": "^1.1.2",
"@nextcloud/router": "^1.2.0",
"@nextcloud/vue": "2.7.0",
"@nextcloud/vue": "^2.8.1",
"axios": "^0.20.0",
"b64-to-blob": "^1.2.19",
"cdav-library": "git+https://github.com/nextcloud/cdav-library.git",
"core-js": "^3.6.5",
"debounce": "^1.2.0",
Expand Down
42 changes: 26 additions & 16 deletions src/components/ContactDetails/ContactDetailsAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,20 @@
:style="{ 'backgroundImage': `url(${contact.photoUrl})` }"
class="contact-header-avatar__photo"
@click="toggleModal" />
<Avatar v-else
:disable-tooltip="true"
:display-name="contact.displayName"
:is-no-user="true"
:size="75"
class="contact-header-avatar__photo" />

<!-- attention, this menu exists twice in this file -->
<Actions
default-icon="icon-picture-force-white"
v-if="!isReadOnly || contact.photo"
:force-menu="true"
:open.sync="opened"
class="contact-header-avatar__menu">
class="contact-header-avatar__menu"
default-icon="icon-picture-force-white">
<template v-if="!isReadOnly">
<ActionButton
icon="icon-upload"
Expand Down Expand Up @@ -90,19 +98,17 @@
@close="toggleModal">
<!-- attention, this menu exists twice in this file -->
<template #actions>
<ActionButton
v-if="!isReadOnly"
icon="icon-upload"
@click="selectFileInput">
{{ t('contacts', 'Upload a new picture') }}
</ActionButton>
<ActionButton
v-if="!isReadOnly"
icon="icon-folder"
@click="selectFilePicker">
{{ t('contacts', 'Choose from files') }}
</ActionButton>
<template v-if="!isReadOnly">
<ActionButton
icon="icon-upload"
@click="selectFileInput">
{{ t('contacts', 'Upload a new picture') }}
</ActionButton>
<ActionButton
icon="icon-folder"
@click="selectFilePicker">
{{ t('contacts', 'Choose from files') }}
</ActionButton>
<ActionButton
v-for="network in supportedSocial"
:key="network"
Expand All @@ -111,6 +117,7 @@
{{ t('contacts', 'Get from ' + network) }}
</ActionButton>
</template>

<!-- FIXME: the link seems to have a bigger font size than the button caption -->
<ActionLink
v-if="contact.photo"
Expand All @@ -126,6 +133,7 @@
{{ t('contacts', 'Delete picture') }}
</ActionButton>
</template>

<img ref="img"
:src="contact.photoUrl"
class="contact-header-modal__photo">
Expand All @@ -134,6 +142,7 @@
</template>

<script>
import Avatar from '@nextcloud/vue/dist/Components/Avatar'
import Modal from '@nextcloud/vue/dist/Components/Modal'
import Actions from '@nextcloud/vue/dist/Components/Actions'
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
Expand All @@ -153,10 +162,11 @@ export default {
name: 'ContactDetailsAvatar',

components: {
Modal,
Actions,
ActionButton,
ActionLink,
Actions,
Avatar,
Modal,
},

props: {
Expand Down
Loading