From 516bd53ce6978649c2b758e7443d4fad0e74aab5 Mon Sep 17 00:00:00 2001 From: Yuriy Bakhtin Date: Fri, 20 Sep 2024 08:15:18 +0200 Subject: [PATCH 1/2] Hide the confirm translation button when the message is translated --- resources/js/humhub.translation.js | 1 + widgets/views/translationForm.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/js/humhub.translation.js b/resources/js/humhub.translation.js index fae38dc..a529342 100644 --- a/resources/js/humhub.translation.js +++ b/resources/js/humhub.translation.js @@ -98,6 +98,7 @@ humhub.module('translation', function(module, require, $) { Form.prototype.copyParent = function (evt) { const input = evt.$trigger.closest('.elem').find('textarea'); input.val(input.attr('placeholder')); + evt.$trigger.remove(); } module.export({ diff --git a/widgets/views/translationForm.php b/widgets/views/translationForm.php index 1dcb29f..0f14f4b 100644 --- a/widgets/views/translationForm.php +++ b/widgets/views/translationForm.php @@ -134,11 +134,11 @@ ->tooltip(Yii::t('TranslationModule.base', 'View translation history')) ->loader(false) ?> - ' . Yii::t('TranslationModule.base', 'Confirm translation') . '') ->icon('check') ->action('copyParent') - ->tooltip(Yii::t('TranslationModule.base', 'Confirm translation')) + ->tooltip(Yii::t('TranslationModule.base', 'Confirm translation')) ->loader(false) : '' ?> From 9fb78091efdd71a90c84cadb00672ecec598a607 Mon Sep 17 00:00:00 2001 From: Yuriy Bakhtin Date: Mon, 23 Sep 2024 08:57:15 +0200 Subject: [PATCH 2/2] Hide the confirm translation button when the message is translated --- resources/css/translation.css | 11 +++++++++-- resources/js/humhub.translation.js | 2 +- widgets/views/translationForm.php | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/resources/css/translation.css b/resources/css/translation.css index 8c529c2..3e63cac 100644 --- a/resources/css/translation.css +++ b/resources/css/translation.css @@ -44,6 +44,10 @@ color: var(--success) !important; } +.translation-confirm-approved { + visibility: hidden; +} + #translation-editor .pre { display: block; padding: 9.5px; @@ -105,7 +109,7 @@ #words .elem { width: 100%; flex-direction: column; - padding-bottom: 0; + padding: 8px 0 0 0; } #words .elem:first-child { padding: 0; @@ -114,7 +118,7 @@ width: 100%; } #words .elem > div:first-child { - margin-bottom: 7px; + margin-bottom: 8px; } #words .elem > div:last-child { display: flex; @@ -135,4 +139,7 @@ #words .elem .btn span { display: inline; } + .translation-confirm-approved { + display: none; + } } diff --git a/resources/js/humhub.translation.js b/resources/js/humhub.translation.js index a529342..cf4f6bf 100644 --- a/resources/js/humhub.translation.js +++ b/resources/js/humhub.translation.js @@ -98,7 +98,7 @@ humhub.module('translation', function(module, require, $) { Form.prototype.copyParent = function (evt) { const input = evt.$trigger.closest('.elem').find('textarea'); input.val(input.attr('placeholder')); - evt.$trigger.remove(); + evt.$trigger.addClass('translation-confirm-approved'); } module.export({ diff --git a/widgets/views/translationForm.php b/widgets/views/translationForm.php index 0f14f4b..b55d942 100644 --- a/widgets/views/translationForm.php +++ b/widgets/views/translationForm.php @@ -134,11 +134,12 @@ ->tooltip(Yii::t('TranslationModule.base', 'View translation history')) ->loader(false) ?> - ' . Yii::t('TranslationModule.base', 'Confirm translation') . '') ->icon('check') ->action('copyParent') ->tooltip(Yii::t('TranslationModule.base', 'Confirm translation')) + ->cssClass($translated === '' ? '' : 'translation-confirm-approved') ->loader(false) : '' ?>