Skip to content

Commit

Permalink
Hide the confirm translation button when the message is translated
Browse files Browse the repository at this point in the history
  • Loading branch information
yurabakhtin committed Sep 23, 2024
1 parent 516bd53 commit 9fb7809
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
11 changes: 9 additions & 2 deletions resources/css/translation.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
color: var(--success) !important;
}

.translation-confirm-approved {
visibility: hidden;
}

#translation-editor .pre {
display: block;
padding: 9.5px;
Expand Down Expand Up @@ -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;
Expand All @@ -114,7 +118,7 @@
width: 100%;
}
#words .elem > div:first-child {
margin-bottom: 7px;
margin-bottom: 8px;
}
#words .elem > div:last-child {
display: flex;
Expand All @@ -135,4 +139,7 @@
#words .elem .btn span {
display: inline;
}
.translation-confirm-approved {
display: none;
}
}
2 changes: 1 addition & 1 deletion resources/js/humhub.translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
3 changes: 2 additions & 1 deletion widgets/views/translationForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,12 @@
->tooltip(Yii::t('TranslationModule.base', 'View translation history'))
->loader(false) ?>

<?= $hasParentLanguage && $translated === '' ?
<?= $hasParentLanguage ?
Button::success('<span>' . Yii::t('TranslationModule.base', 'Confirm translation') . '</span>')
->icon('check')
->action('copyParent')
->tooltip(Yii::t('TranslationModule.base', 'Confirm translation'))
->cssClass($translated === '' ? '' : 'translation-confirm-approved')
->loader(false) : '' ?>
</div>
</div>
Expand Down

0 comments on commit 9fb7809

Please sign in to comment.