Merge branch 'develop' of github.com:tainacan/tainacan into develop

This commit is contained in:
vnmedeiros 2022-08-03 15:19:48 -03:00
commit 46e12d61ec
4 changed files with 38 additions and 11 deletions

View File

@ -20,7 +20,8 @@
v-if="form.document != undefined && form.document != null && v-if="form.document != undefined && form.document != null &&
form.document_type != undefined && form.document_type != null && form.document_type != undefined && form.document_type != null &&
form.document != '' && form.document_type != 'empty'" form.document != '' && form.document_type != 'empty'"
class="document-field-content"> class="document-field-content"
:class="'document-field-content--' + form.document_type">
<div v-html="item.document_as_html" /> <div v-html="item.document_as_html" />
<div class="document-buttons-row"> <div class="document-buttons-row">
<a <a
@ -113,6 +114,10 @@ export default {
.document-field-content { .document-field-content {
max-height: 32vh; max-height: 32vh;
&.document-field-content--text {
padding-bottom: 2rem;
}
/deep/ img, /deep/ img,
/deep/ video, /deep/ video,
/deep/ figure { /deep/ figure {
@ -134,6 +139,9 @@ export default {
margin: 0; margin: 0;
min-height: 150px; min-height: 150px;
} }
/deep/ audio {
min-height: 80px;
}
@media screen and (max-height: 760px) { @media screen and (max-height: 760px) {
max-height: 25vh; max-height: 25vh;

View File

@ -491,7 +491,7 @@
:form="form" :form="form"
:is-loading="isLoading" :is-loading="isLoading"
@onDeleteThumbnail="deleteThumbnail" @onDeleteThumbnail="deleteThumbnail"
@onUpdateThumbnailAlt="($event) => form.thumbnail_alt = $event.target.value" @onUpdateThumbnailAlt="($event) => onUpdateThumbnailAlt($event)"
@openThumbnailMediaFrame="thumbnailMediaFrame.openFrame($event)" /> @openThumbnailMediaFrame="thumbnailMediaFrame.openFrame($event)" />
</div> </div>
@ -590,7 +590,7 @@
:form="form" :form="form"
:is-loading="isLoading" :is-loading="isLoading"
@onDeleteThumbnail="deleteThumbnail" @onDeleteThumbnail="deleteThumbnail"
@onUpdateThumbnailAlt="($event) => form.thumbnail_alt = $event.target.value" @onUpdateThumbnailAlt="($event) => onUpdateThumbnailAlt($event)"
@openThumbnailMediaFrame="thumbnailMediaFrame.openFrame($event)" /> @openThumbnailMediaFrame="thumbnailMediaFrame.openFrame($event)" />
<hr v-if="!$adminOptions.itemEditionAttachmentsInsideTabs || hasEndLeftForm"> <hr v-if="!$adminOptions.itemEditionAttachmentsInsideTabs || hasEndLeftForm">
@ -791,7 +791,7 @@ export default {
attachmentsMediaFrame: undefined, attachmentsMediaFrame: undefined,
fileMediaFrame: undefined, fileMediaFrame: undefined,
urlLink: '', urlLink: '',
textLink: '', textContent: '',
isUpdatingValues: false, isUpdatingValues: false,
entityName: 'item', entityName: 'item',
activeTab: 'metadata', activeTab: 'metadata',
@ -1382,6 +1382,9 @@ export default {
if (item.document_type != undefined && item.document_type == 'url') if (item.document_type != undefined && item.document_type == 'url')
this.urlLink = item.document; this.urlLink = item.document;
if (item.document_type != undefined && item.document_type == 'text')
this.textContent = item.document;
if (item.document_options !== undefined && item.document_options['forced_iframe'] !== undefined) if (item.document_options !== undefined && item.document_options['forced_iframe'] !== undefined)
this.urlForcedIframe = item.document_options['forced_iframe']; this.urlForcedIframe = item.document_options['forced_iframe'];
@ -1395,8 +1398,10 @@ export default {
this.isLoading = false; this.isLoading = false;
let oldThumbnail = this.item.thumbnail; 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 = item.thumbnail;
this.item.thumbnail_id = item.thumbnail_id;
}
}) })
.catch((errors) => { .catch((errors) => {
for (let error of errors.errors) { for (let error of errors.errors) {
@ -1493,8 +1498,10 @@ export default {
this.item.document_mimetype = item.document_mimetype; this.item.document_mimetype = item.document_mimetype;
let oldThumbnail = this.item.thumbnail; 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 = item.thumbnail;
this.item.thumbnail_id = item.thumbnail_id;
}
this.shouldLoadAttachments = !this.shouldLoadAttachments; this.shouldLoadAttachments = !this.shouldLoadAttachments;
@ -1552,11 +1559,12 @@ export default {
}, },
onUpdateThumbnailAlt(updatedThumbnailAlt) { onUpdateThumbnailAlt(updatedThumbnailAlt) {
this.isUpdatingValues = true;
this.updateThumbnailAlt({ thumbnailId: this.item.thumbnail_id, thumbnailAlt: updatedThumbnailAlt }) this.updateThumbnailAlt({ thumbnailId: this.item.thumbnail_id, thumbnailAlt: updatedThumbnailAlt })
.then((res) => { .then((res) => {
this.form.thumbnail_id = res.thumbnail_id; this.form.thumbnail_alt = res.alt_text;
this.form.thumbnail_alt = res.thumbnail_alt; this.isUpdatingValues = false;
}) })
.catch(error => this.$console.error(error)); .catch(error => this.$console.error(error));
}, },

View File

@ -42,6 +42,7 @@
:src="$thumbHelper.getEmptyThumbnailPlaceholder(item.document_mimetype)"> :src="$thumbHelper.getEmptyThumbnailPlaceholder(item.document_mimetype)">
</figure> </figure>
<b-field <b-field
v-if="item.thumbnail_id"
:addons="false" :addons="false"
:label="$i18n.get('label_thumbnail_alt')"> :label="$i18n.get('label_thumbnail_alt')">
<help-button <help-button
@ -51,8 +52,8 @@
id="tainacan-text-description" id="tainacan-text-description"
class="textarea" class="textarea"
rows="4" rows="4"
:value="form.thumbnail_alt" :value="form.thumbnail_alt && form.thumbnail_alt != 'false' ? form.thumbnail_alt : ''"
@input="$emit('onUpdateThumbnailAlt')" /> @input="updateThumbnailAlt" />
</b-field> </b-field>
<div class="thumbnail-buttons-row"> <div class="thumbnail-buttons-row">
<a <a
@ -104,6 +105,11 @@ export default {
props: { props: {
item: Object, item: Object,
form: Object form: Object
},
methods: {
updateThumbnailAlt: _.debounce(function($event) {
this.$emit('onUpdateThumbnailAlt', $event.target.value);
}, 750)
} }
} }
</script> </script>

View File

@ -24,7 +24,7 @@
<button <button
id="button-submit-text-content-writing" id="button-submit-text-content-writing"
type="submit" type="submit"
@click.prevent="$parent.close();" @click.prevent="confirmTextWriting();$parent.close();"
class="button is-success"> class="button is-success">
{{ $i18n.get('save') }}</button> {{ $i18n.get('save') }}</button>
</div> </div>
@ -55,6 +55,11 @@ export default {
this.$refs['item-document-text-input']['$el'].children[0].focus(); this.$refs['item-document-text-input']['$el'].children[0].focus();
this.$refs['item-document-text-input']['$el'].children[0].click(); this.$refs['item-document-text-input']['$el'].children[0].click();
} }
},
methods: {
confirmTextWriting() {
this.$emit('confirmTextWriting', this.localTextContent);
}
} }
} }
</script> </script>