From d58d748906f85682bd69bf1180d57cb9c9035c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20L=C3=B6ffler?= Date: Thu, 11 Jul 2024 16:41:24 +0200 Subject: [PATCH] [BUGFIX] Only update translations list on translation task --- .../Public/JavaScript/AjaxMetaGenerate.js | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/Resources/Public/JavaScript/AjaxMetaGenerate.js b/Resources/Public/JavaScript/AjaxMetaGenerate.js index d70e5eb..0f9393a 100644 --- a/Resources/Public/JavaScript/AjaxMetaGenerate.js +++ b/Resources/Public/JavaScript/AjaxMetaGenerate.js @@ -158,24 +158,26 @@ function callAjaxMetaSaveAction(fileIdentifier, textarea, doTranslate, button, b if (response && response.saved) { // html list of all translations from response.translations - let otherLanguages = blockElement.querySelector('.otherLanguages'); - otherLanguages.innerHTML = ''; - let ul = document.createElement('ul'); - response.translations.forEach((translation) => { - let li = document.createElement('li'); - let img = document.createElement('img'); - let link = document.createElement('a'); - img.src = '/typo3/sysext/core/Resources/Public/Icons/Flags/' + translation.languageFlagIdentifier + '.webp'; // Adjust the path as necessary - img.title = translation.title; - li.appendChild(img); - - link.href = translation.editLink + '&returnUrl=' + encodeURIComponent(currentUrl); - link.textContent = ' ' + translation.altTextTranslated; - li.appendChild(link); - ul.appendChild(li); - - otherLanguages.appendChild(ul); - }); + if (doTranslate) { + let otherLanguages = blockElement.querySelector('.otherLanguages'); + otherLanguages.innerHTML = ''; + let ul = document.createElement('ul'); + response.translations.forEach((translation) => { + let li = document.createElement('li'); + let img = document.createElement('img'); + let link = document.createElement('a'); + img.src = '/typo3/sysext/core/Resources/Public/Icons/Flags/' + translation.languageFlagIdentifier + '.webp'; // Adjust the path as necessary + img.title = translation.title; + li.appendChild(img); + + link.href = translation.editLink + '&returnUrl=' + encodeURIComponent(currentUrl); + link.textContent = ' ' + translation.altTextTranslated; + li.appendChild(link); + ul.appendChild(li); + + otherLanguages.appendChild(ul); + }); + } top.TYPO3.Notification.success('Saved Metadata', 'Saved Metadata successful', 5); button.dispatchEvent(new CustomEvent('ajaxComplete'));