jenkins-bot has submitted this change and it was merged.
Change subject: Editor: do not show "Suggestions" when no suggestions
......................................................................
Editor: do not show "Suggestions" when no suggestions
If the only suggestion was the current translation of the
message, which is filtered out, the heading would be shown
but no suggestions were visible.
Change-Id: I5f7bceaf05dbaee00d93215bec4735f017a32428
---
M resources/js/ext.translate.editor.helpers.js
1 file changed, 12 insertions(+), 6 deletions(-)
Approvals:
Santhosh: Looks good to me, approved
jenkins-bot: Verified
diff --git a/resources/js/ext.translate.editor.helpers.js
b/resources/js/ext.translate.editor.helpers.js
index af739c7..deea609 100644
--- a/resources/js/ext.translate.editor.helpers.js
+++ b/resources/js/ext.translate.editor.helpers.js
@@ -255,18 +255,19 @@
* @param {array} suggestions A ttmserver array as returned by
API.
*/
showTranslationMemory: function ( suggestions ) {
- var $tmSuggestions, $translationTextarea,
+ var $heading, $tmSuggestions, $translationTextarea,
translateEditor = this;
if ( !suggestions.length ) {
return;
}
- $tmSuggestions = $( '<div>' )
- .addClass( 'tm-suggestions' );
- this.$editor.find( '.tm-suggestions-title' )
- .removeClass( 'hide' )
- .after( $tmSuggestions );
+ // Container for the suggestions
+ $tmSuggestions = $( '<div>' ).addClass(
'tm-suggestions' );
+
+ $heading = this.$editor.find( '.tm-suggestions-title' );
+ $heading.after( $tmSuggestions );
+
$translationTextarea = this.$editor.find(
'.tux-textarea-translation' );
$.each( suggestions, function ( index, translation ) {
@@ -326,6 +327,11 @@
$tmSuggestions.append( $translation );
} );
+
+ // Show the heading only if we actually have suggestions
+ if ( $tmSuggestions.length ) {
+ $heading.removeClass( 'hide' );
+ }
},
/**
--
To view, visit https://gerrit.wikimedia.org/r/91591
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5f7bceaf05dbaee00d93215bec4735f017a32428
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
Gerrit-Reviewer: KartikMistry <[email protected]>
Gerrit-Reviewer: Santhosh <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits