Amire80 has uploaded a new change for review.

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


Change subject: WIP: Reload the stash at the last message
......................................................................

WIP: Reload the stash at the last message

Change-Id: I768082c54600653d7b5cb4f58b4c55822a2acc01
---
M resources/js/ext.translate.editor.js
M resources/js/ext.translate.special.translationstash.js
2 files changed, 19 insertions(+), 0 deletions(-)


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

diff --git a/resources/js/ext.translate.editor.js 
b/resources/js/ext.translate.editor.js
index 5f62b30..2f4c3b1 100644
--- a/resources/js/ext.translate.editor.js
+++ b/resources/js/ext.translate.editor.js
@@ -249,6 +249,7 @@
                                this.$editTrigger = $next;
                                return this.next();
                        }
+
                        // If this is the last message, just hide it
                        if ( !$next.length ) {
                                this.hide();
@@ -598,15 +599,22 @@
                                .on( 'click', function ( e ) {
                                        translateEditor.skip();
                                        translateEditor.next();
+
+                                       if ( translateEditor.options.onSkip ) {
+                                               
translateEditor.options.onSkip.call( translateEditor );
+                                       }
+
                                        e.stopPropagation();
                                } );
 
+                       // This appears instead of "Skip" on the last message 
on the page
                        $cancelButton = $( '<button>' )
                                .addClass( 'button tux-editor-cancel-button' )
                                .text( mw.msg( 'tux-editor-cancel-button-label' 
) )
                                .on( 'click', function ( e ) {
                                        translateEditor.skip();
                                        translateEditor.hide();
+
                                        e.stopPropagation();
                                } );
 
diff --git a/resources/js/ext.translate.special.translationstash.js 
b/resources/js/ext.translate.special.translationstash.js
index c16447b..39b009a 100644
--- a/resources/js/ext.translate.special.translationstash.js
+++ b/resources/js/ext.translate.special.translationstash.js
@@ -102,6 +102,17 @@
                        message: message,
                        storage: translationStashStorage,
                        onSave: updateStats,
+                       onSkip: function () {
+                               var $next = this.$editTrigger.next( 
'.tux-message' );
+
+                               // This can happen when it's
+                               // the last message in the translation stash
+                               if ( !$next.length ) {
+                                       // Reload the page to get more messages
+                                       // when we get to the last one
+                                       window.location.reload();
+                               }
+                       },
                        onReady: function () {
                                this.$editor.find( '.tux-editor-skip-button' )
                                        .text( mw.msg( 
'translate-translationstash-skip-button-label' ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I768082c54600653d7b5cb4f58b4c55822a2acc01
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

Reply via email to