Skip to content

Commit

Permalink
IBX-7954: Show error message on empty image asset
Browse files Browse the repository at this point in the history
  • Loading branch information
barw4 committed Mar 18, 2024
1 parent 80eeb14 commit fd71c45
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/bundle/Resources/public/js/scripts/fieldType/ezimageasset.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,18 @@
* @param {Object} image
*/
updateData(destinationContentId, destinationContentName, destinationLocationId, image) {
if (image === null) {
showErrorNotification(
Translator.trans(
/* @Desc("The chosen asset has no image data available.") */ 'ezimageasset.empty_data.message.error',
{},
'fieldtypes_preview'
)
);

return;
}

const preview = this.fieldContainer.querySelector('.ez-field-edit__preview');
const previewVisual = preview.querySelector('.ez-field-edit-preview__visual');
const previewImg = preview.querySelector('.ez-field-edit-preview__media');
Expand Down
5 changes: 5 additions & 0 deletions src/bundle/Resources/translations/fieldtypes_preview.en.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@
<target state="new">Alternative text</target>
<note>key: ezimageasset.alternative_text</note>
</trans-unit>
<trans-unit id="75c1175bca5f2a2334ffe321afdaedf7fa6887bd" resname="ezimageasset.empty_data.message.error">
<source>The chosen asset has no image data available.</source>
<target state="new">The chosen asset has no image data available.</target>
<note>key: ezimageasset.empty_data.message.error</note>
</trans-unit>
<trans-unit id="6ccdfa3f93ea5a6c0c17a7a9f6fe8fac4d5b6926" resname="ezimageasset.file_name">
<source>File name</source>
<target state="new">File name</target>
Expand Down

0 comments on commit fd71c45

Please sign in to comment.