Updates thumbnail_alt flow on item edition.
This commit is contained in:
parent
7e01e39d13
commit
97e6222b89
|
@ -491,7 +491,7 @@
|
|||
:form="form"
|
||||
:is-loading="isLoading"
|
||||
@onDeleteThumbnail="deleteThumbnail"
|
||||
@onUpdateThumbnailAlt="($event) => form.thumbnail_alt = $event.target.value"
|
||||
@onUpdateThumbnailAlt="($event) => onUpdateThumbnailAlt($event)"
|
||||
@openThumbnailMediaFrame="thumbnailMediaFrame.openFrame($event)" />
|
||||
</div>
|
||||
|
||||
|
@ -590,7 +590,7 @@
|
|||
:form="form"
|
||||
:is-loading="isLoading"
|
||||
@onDeleteThumbnail="deleteThumbnail"
|
||||
@onUpdateThumbnailAlt="($event) => form.thumbnail_alt = $event.target.value"
|
||||
@onUpdateThumbnailAlt="($event) => onUpdateThumbnailAlt($event)"
|
||||
@openThumbnailMediaFrame="thumbnailMediaFrame.openFrame($event)" />
|
||||
|
||||
<hr v-if="!$adminOptions.itemEditionAttachmentsInsideTabs || hasEndLeftForm">
|
||||
|
@ -1395,8 +1395,10 @@ export default {
|
|||
this.isLoading = false;
|
||||
|
||||
let oldThumbnail = this.item.thumbnail;
|
||||
if (item.document_type == 'url' && oldThumbnail != item.thumbnail )
|
||||
if (item.document_type == 'url' && oldThumbnail != item.thumbnail ) {
|
||||
this.item.thumbnail = item.thumbnail;
|
||||
this.item.thumbnail_id = item.thumbnail_id;
|
||||
}
|
||||
})
|
||||
.catch((errors) => {
|
||||
for (let error of errors.errors) {
|
||||
|
@ -1493,8 +1495,10 @@ export default {
|
|||
this.item.document_mimetype = item.document_mimetype;
|
||||
|
||||
let oldThumbnail = this.item.thumbnail;
|
||||
if (item.document_type == 'attachment' && oldThumbnail != item.thumbnail )
|
||||
if (item.document_type == 'attachment' && oldThumbnail != item.thumbnail ) {
|
||||
this.item.thumbnail = item.thumbnail;
|
||||
this.item.thumbnail_id = item.thumbnail_id;
|
||||
}
|
||||
|
||||
this.shouldLoadAttachments = !this.shouldLoadAttachments;
|
||||
|
||||
|
@ -1552,11 +1556,12 @@ export default {
|
|||
|
||||
},
|
||||
onUpdateThumbnailAlt(updatedThumbnailAlt) {
|
||||
this.isUpdatingValues = true;
|
||||
|
||||
this.updateThumbnailAlt({ thumbnailId: this.item.thumbnail_id, thumbnailAlt: updatedThumbnailAlt })
|
||||
.then((res) => {
|
||||
this.form.thumbnail_id = res.thumbnail_id;
|
||||
this.form.thumbnail_alt = res.thumbnail_alt;
|
||||
this.form.thumbnail_alt = res.alt_text;
|
||||
this.isUpdatingValues = false;
|
||||
})
|
||||
.catch(error => this.$console.error(error));
|
||||
},
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
:src="$thumbHelper.getEmptyThumbnailPlaceholder(item.document_mimetype)">
|
||||
</figure>
|
||||
<b-field
|
||||
v-if="item.thumbnail_id"
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_thumbnail_alt')">
|
||||
<help-button
|
||||
|
@ -51,8 +52,8 @@
|
|||
id="tainacan-text-description"
|
||||
class="textarea"
|
||||
rows="4"
|
||||
:value="form.thumbnail_alt"
|
||||
@input="$emit('onUpdateThumbnailAlt')" />
|
||||
:value="form.thumbnail_alt && form.thumbnail_alt != 'false' ? form.thumbnail_alt : ''"
|
||||
@input="updateThumbnailAlt" />
|
||||
</b-field>
|
||||
<div class="thumbnail-buttons-row">
|
||||
<a
|
||||
|
@ -104,6 +105,11 @@ export default {
|
|||
props: {
|
||||
item: Object,
|
||||
form: Object
|
||||
},
|
||||
methods: {
|
||||
updateThumbnailAlt: _.debounce(function($event) {
|
||||
this.$emit('onUpdateThumbnailAlt', $event.target.value);
|
||||
}, 750)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue