Fix an issue with Identity Picker
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
20ffd2ad0f
commit
9e4378d4db
@ -12,7 +12,7 @@
|
|||||||
>{{ $t("Comments are closed for everybody else.") }}</b-notification
|
>{{ $t("Comments are closed for everybody else.") }}</b-notification
|
||||||
>
|
>
|
||||||
<article class="media">
|
<article class="media">
|
||||||
<figure class="media-left">
|
<figure class="media-left" v-if="newComment.actor">
|
||||||
<identity-picker-wrapper :inline="false" v-model="newComment.actor" />
|
<identity-picker-wrapper :inline="false" v-model="newComment.actor" />
|
||||||
</figure>
|
</figure>
|
||||||
<div class="media-content">
|
<div class="media-content">
|
||||||
|
@ -9,7 +9,9 @@
|
|||||||
class="list-item"
|
class="list-item"
|
||||||
v-for="identity in identities"
|
v-for="identity in identities"
|
||||||
:key="identity.id"
|
:key="identity.id"
|
||||||
:class="{ 'is-active': identity.id === currentIdentity.id }"
|
:class="{
|
||||||
|
'is-active': currentIdentity && identity.id === currentIdentity.id,
|
||||||
|
}"
|
||||||
@click="changeCurrentIdentity(identity)"
|
@click="changeCurrentIdentity(identity)"
|
||||||
>
|
>
|
||||||
<div class="media">
|
<div class="media">
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="identity-picker">
|
<div class="identity-picker">
|
||||||
<div
|
<div
|
||||||
v-if="inline"
|
v-if="inline && currentIdentity"
|
||||||
class="inline box"
|
class="inline box"
|
||||||
:class="{
|
:class="{
|
||||||
'has-background-grey-lighter': masked,
|
'has-background-grey-lighter': masked,
|
||||||
@ -39,14 +39,14 @@
|
|||||||
</b-button>
|
</b-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span v-else class="block" @click="activateModal">
|
<span v-else-if="currentIdentity" class="block" @click="activateModal">
|
||||||
<figure class="image is-48x48" v-if="currentIdentity.avatar">
|
<figure class="image is-48x48" v-if="currentIdentity.avatar">
|
||||||
<img class="is-rounded" :src="currentIdentity.avatar.url" alt="" />
|
<img class="is-rounded" :src="currentIdentity.avatar.url" alt="" />
|
||||||
</figure>
|
</figure>
|
||||||
<b-icon v-else size="is-large" icon="account-circle" />
|
<b-icon v-else size="is-large" icon="account-circle" />
|
||||||
</span>
|
</span>
|
||||||
<b-modal v-model="isComponentModalActive" has-modal-card>
|
<b-modal v-model="isComponentModalActive" has-modal-card>
|
||||||
<identity-picker v-model="currentIdentity" @input="relay" />
|
<identity-picker v-model="currentIdentity" />
|
||||||
</b-modal>
|
</b-modal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -69,21 +69,22 @@ export default class IdentityPickerWrapper extends Vue {
|
|||||||
|
|
||||||
@Prop({ default: true, type: Boolean }) inline!: boolean;
|
@Prop({ default: true, type: Boolean }) inline!: boolean;
|
||||||
|
|
||||||
@Prop({ type: Boolean, required: false, default: false }) masked = false;
|
@Prop({ type: Boolean, required: false, default: false }) masked!: boolean;
|
||||||
|
|
||||||
isComponentModalActive = false;
|
isComponentModalActive = false;
|
||||||
|
|
||||||
identities: IActor[] = [];
|
identities: IActor[] = [];
|
||||||
|
|
||||||
currentIdentity: IActor = this.value;
|
|
||||||
|
|
||||||
@Watch("value")
|
@Watch("value")
|
||||||
updateCurrentActor(value: IActor): void {
|
updateCurrentActor(value: IActor): void {
|
||||||
this.currentIdentity = value;
|
this.currentIdentity = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
relay(identity: IActor): void {
|
get currentIdentity(): IActor | undefined {
|
||||||
this.currentIdentity = identity;
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
set currentIdentity(identity: IActor | undefined) {
|
||||||
this.$emit("input", identity);
|
this.$emit("input", identity);
|
||||||
this.isComponentModalActive = false;
|
this.isComponentModalActive = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user