Amire80 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/54218
Change subject: (bug 45420) Make sure that the fuzzy warning is shown
......................................................................
(bug 45420) Make sure that the fuzzy warning is shown
Always show the fuzzy warning if the message is fuzzy, even
if the diff cannot be loaded.
Also changed addWarning to return the new warning element.
Change-Id: Ic54ea0c7178904b20fae7420e0fe0cc6ea8aeeca
---
M resources/js/ext.translate.editor.js
1 file changed, 23 insertions(+), 14 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate
refs/changes/18/54218/1
diff --git a/resources/js/ext.translate.editor.js
b/resources/js/ext.translate.editor.js
index f82300c..3dc1a22 100644
--- a/resources/js/ext.translate.editor.js
+++ b/resources/js/ext.translate.editor.js
@@ -37,6 +37,20 @@
this.expanded = false;
this.$editTrigger.append( this.$editor );
+ if ( this.$editTrigger.data( 'message'
).properties.status === 'fuzzy' ) {
+ this.addWarning(
+ mw.msg( 'tux-editor-outdated-warning' ),
+ 'diff'
+ ).append( $( '<span>' )
+ // Hide initially.
+ // Will be shows if there's a valid
diff available.
+ .addClass( 'show-diff-link hide' )
+ .text(
+ mw.message(
'tux-editor-outdated-warning-diff-link' ).escaped()
+ )
+ );
+ }
+
this.showTranslationHelpers();
},
@@ -515,18 +529,19 @@
*
* @param {String} warning used as html for the warning display
* @param {String} type used to group the warnings.eg:
validation, diff, error
+ * @return {jQuery} the new warning element
*/
addWarning: function ( warning, type ) {
var warningCount,
$warnings = this.$editor.find( '.tux-warning' ),
- $moreWarningsTab = this.$editor.find(
'.tux-more-warnings' );
+ $moreWarningsTab = this.$editor.find(
'.tux-more-warnings' ),
+ $newWarning = $( '<div>' )
+ .addClass( 'tux-warning-message hide '
+ type )
+ .html( warning );
$warnings
.removeClass( 'hide' )
- .append( $( '<div>' )
- .addClass( 'tux-warning-message hide '
+ type )
- .html( warning )
- );
+ .append( $newWarning );
warningCount = $warnings.find( '.tux-warning-message'
).length;
@@ -539,6 +554,8 @@
} else {
$moreWarningsTab.addClass( 'hide' );
}
+
+ return $newWarning;
},
prepareInfoColumn: function () {
@@ -750,22 +767,14 @@
* @param {object} definitiondiff A definitiondiff object as
returned by API.
*/
addDefinitionDiff: function ( definitiondiff ) {
-
if ( !definitiondiff || definitiondiff.error ) {
mw.log( 'Error loading translation diff ' +
definitiondiff && definitiondiff.error );
return;
}
// TODO add an option to hide diff
- this.addWarning(
- mw.msg( 'tux-editor-outdated-warning' ) +
- '<span class="show-diff-link">' +
- mw.message(
'tux-editor-outdated-warning-diff-link' ).escaped() +
- '</span>',
- 'diff'
- );
-
this.$editor.find( '.tux-warning .show-diff-link' )
+ .removeClass( 'hide' )
.on( 'click', function () {
$( this ).parent().html(
definitiondiff.html );
} );
--
To view, visit https://gerrit.wikimedia.org/r/54218
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic54ea0c7178904b20fae7420e0fe0cc6ea8aeeca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits