Nikerabbit has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/154246

Change subject: Give yellow warning background to the status if saving failed
......................................................................

Give yellow warning background to the status if saving failed

Refactored some code to avoid having to deal with css specifity
for the background color. This should make it easier to spot
when saving failed.

Bug: 69314
Change-Id: I53886fa4d23a8e3911c9ffeb09bf833887af4fb8
---
M resources/css/ext.translate.editor.css
M resources/css/ext.translate.messagetable.css
M resources/js/ext.translate.editor.js
3 files changed, 34 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate 
refs/changes/46/154246/1

diff --git a/resources/css/ext.translate.editor.css 
b/resources/css/ext.translate.editor.css
index 89bb52d..38ab67c 100644
--- a/resources/css/ext.translate.editor.css
+++ b/resources/css/ext.translate.editor.css
@@ -249,6 +249,10 @@
        background-color: #FFFFCC;
 }
 
+.tux-highlight {
+       background-color: #C9C9C9;
+}
+
 .tux-warning-message {
        font-size: 14px;
        padding: 2px 15% 2px 5px;
diff --git a/resources/css/ext.translate.messagetable.css 
b/resources/css/ext.translate.messagetable.css
index 5489648..07ec579 100644
--- a/resources/css/ext.translate.messagetable.css
+++ b/resources/css/ext.translate.messagetable.css
@@ -136,7 +136,6 @@
        background-image: -webkit-linear-gradient(transparent, transparent), 
url(../images/label-pen.svg);
        /* @embed */
        background-image: linear-gradient(transparent, transparent), 
url(../images/label-pen.svg);
-       background-color: #C9C9C9;
 }
 
 .tux-status-translated,
diff --git a/resources/js/ext.translate.editor.js 
b/resources/js/ext.translate.editor.js
index d17e846..d19754c 100644
--- a/resources/js/ext.translate.editor.js
+++ b/resources/js/ext.translate.editor.js
@@ -90,16 +90,29 @@
                },
 
                /**
-                * Mark the message as unsaved, can be resumed later
+                * Mark the message as unsaved because of edits, can be resumed 
later
+                * @param {string} [highlightClass] Class for background 
highlighting
                 */
-               markUnsaved: function () {
-                       this.$editTrigger.find( '.tux-list-status' )
-                               .children().addClass( 'hide' ).end()
-                               .append( $( '<span>' )
-                                       .addClass( 'tux-status-unsaved' )
-                                       .text( mw.msg( 'tux-status-unsaved' ) )
-                               );
+               markUnsaved: function ( highlightClass ) {
+                       var $tuxListStatus = this.$editTrigger.find( 
'.tux-list-status' );
+
+                       highlightClass = highlightClass || 'tux-highlight';
+
+                       $tuxListStatus.children( '.tux-status-unsaved' 
).remove();
+                       $tuxListStatus.children().addClass( 'hide' );
+                       $( '<span>' )
+                               .addClass( 'tux-status-unsaved ' + 
highlightClass )
+                               .text( mw.msg( 'tux-status-unsaved' ) )
+                               .appendTo( $tuxListStatus );
                },
+
+               /**
+                * Mark the message as unsaved because of saving failure.
+                */
+               markUnsavedFailure: function () {
+                       this.markUnsaved( 'tux-warning' );
+               },
+
 
                /**
                 * Mark the message as no longer unsaved
@@ -107,7 +120,7 @@
                markUnunsaved: function () {
                        var $tuxListStatus = this.$editTrigger.find( 
'.tux-list-status' );
 
-                       $tuxListStatus.find( '.tux-status-unsaved' ).remove();
+                       $tuxListStatus.children( '.tux-status-unsaved' 
).remove();
                        $tuxListStatus.children().removeClass( 'hide' );
 
                        this.dirty = false;
@@ -118,17 +131,18 @@
                 * Mark the message as being saved
                 */
                markSaving: function () {
+                       var $tuxListStatus = this.$editTrigger.find( 
'.tux-list-status' );
+
                        // Disable the save button
                        this.$editor.find( '.tux-editor-save-button' )
                                .prop( 'disabled', true );
 
                        // Add a "Saving" indicator
-                       this.$editTrigger.find( '.tux-list-status' )
-                               .empty()
-                               .append( $( '<span>' )
-                                       .addClass( 'tux-status-unsaved' )
-                                       .text( mw.msg( 'tux-status-saving' ) )
-                               );
+                       $tuxListStatus.empty();
+                       $( '<span>' )
+                               .addClass( 'tux-status-unsaved' )
+                               .text( mw.msg( 'tux-status-saving' ) )
+                               .appendTo( $tuxListStatus );
                },
 
                /**
@@ -241,7 +255,7 @@
                                'translation-saving'
                        );
                        this.saving = false;
-                       this.markUnsaved();
+                       this.markUnsavedFailure();
                },
 
                /**

-- 
To view, visit https://gerrit.wikimedia.org/r/154246
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I53886fa4d23a8e3911c9ffeb09bf833887af4fb8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to