BPositive has uploaded a new change for review.

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

Change subject: Cancel button added for Special:PagePreparation
......................................................................

Cancel button added for Special:PagePreparation

A "Cancel" button has been added for Special:PagePreparation to
allow the user discard the preparation done by the tool. The message
shown after preparing the page has been modified to include this
information.

Bug: 69591
Change-Id: I1766914018bcde695490e40554feae9f473b463a
---
M Resources.php
M i18n/pagetranslation/en.json
M i18n/pagetranslation/qqq.json
M resources/js/ext.translate.pagepreparation.js
M specials/SpecialPagePreparation.php
5 files changed, 13 insertions(+), 1 deletion(-)


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

diff --git a/Resources.php b/Resources.php
index a863591..31bf18a 100644
--- a/Resources.php
+++ b/Resources.php
@@ -239,6 +239,7 @@
                'pp-save-summary',
                'pp-save-message',
                'pp-save-button-label',
+               'pp-cancel-button-label',
                'pp-prepare-message',
                'pp-already-prepared-message',
                'pp-pagename-missing'
diff --git a/i18n/pagetranslation/en.json b/i18n/pagetranslation/en.json
index 3ae170d..8019473 100644
--- a/i18n/pagetranslation/en.json
+++ b/i18n/pagetranslation/en.json
@@ -185,8 +185,9 @@
     "pp-pagename-placeholder": "Enter the page name",
     "pp-prepare-button-label": "Prepare",
     "pp-save-button-label": "Save",
+    "pp-cancel-button-label": "Cancel",
     "pp-save-message": "The page was saved. You can [$1 edit] it.",
-    "pp-prepare-message": "The page was prepared for translation. See the diff 
below. Click the \"{{int:pp-save-button-label}}\" button if okay!",
+    "pp-prepare-message": "The page was prepared for translation. See the diff 
below. Click the \"{{int:pp-save-button-label}}\" button if okay! If you wish 
to abort, click the \"{{int:pp-cancel-button-label}}\" button.",
     "pp-already-prepared-message": "It seems the page has already been 
prepared for translation. There are no changes compared to the previous 
version.",
     "pp-pagename-missing": "Please enter the page name.",
     "pp-diff-old-header": "Source text",
diff --git a/i18n/pagetranslation/qqq.json b/i18n/pagetranslation/qqq.json
index 70a082e..e854d8e 100644
--- a/i18n/pagetranslation/qqq.json
+++ b/i18n/pagetranslation/qqq.json
@@ -185,6 +185,7 @@
        "pp-pagename-placeholder": "Placeholder for the pagename input field.",
        "pp-prepare-button-label": "Used as label for the \"Prepare\" 
button.\n{{Identical|Prepare}}",
        "pp-save-button-label": "Used as label for the \"Save\" 
button.\n{{Identical|Save}}",
+       "pp-cancel-button-label": "Used as label for the \"Cancel\" 
button.\n{{Identical|Cancel}}",
        "pp-save-message": "Message shown after the page is saved with the 
prepared text which contains a link to edit it",
        "pp-prepare-message": "Info message shown after the page is prepared 
for translation",
        "pp-already-prepared-message": "Info message shown if the page is 
already prepared for translation",
diff --git a/resources/js/ext.translate.pagepreparation.js 
b/resources/js/ext.translate.pagepreparation.js
index 0cd5fd0..e440815 100644
--- a/resources/js/ext.translate.pagepreparation.js
+++ b/resources/js/ext.translate.pagepreparation.js
@@ -249,6 +249,10 @@
        $( document ).ready( function () {
                var pageContent;
 
+               $( '#action-cancel' ).click( function () {
+                       document.location.reload( true );
+               } );
+
                $( '#action-save' ).click( function () {
                        var serverName, pageUrl = '', pageName;
                        pageName = $.trim( $( '#title' ).val() );
@@ -260,6 +264,7 @@
                                $( '#action-prepare' ).show();
                                $( '#title' ).val( '' );
                                $( '#action-save' ).hide();
+                               $( '#action-cancel' ).hide();
                        } );
                } );
 
@@ -290,6 +295,7 @@
                                                        messageDiv.html( 
mw.msg( 'pp-prepare-message' ) ).show();
                                                        $( '#action-prepare' 
).hide();
                                                        $( '#action-save' 
).show();
+                                                       $( '#action-cancel' 
).show();
                                                } else {
                                                        messageDiv.html( 
mw.msg( 'pp-already-prepared-message' ) ).show();
                                                }
diff --git a/specials/SpecialPagePreparation.php 
b/specials/SpecialPagePreparation.php
index 6b05634..7faf43c 100644
--- a/specials/SpecialPagePreparation.php
+++ b/specials/SpecialPagePreparation.php
@@ -21,6 +21,7 @@
                $pagenamePlaceholder = $this->msg( 'pp-pagename-placeholder' 
)->escaped();
                $prepareButtonValue = $this->msg( 'pp-prepare-button-label' 
)->escaped();
                $saveButtonValue = $this->msg( 'pp-save-button-label' 
)->escaped();
+               $cancelButtonValue = $this->msg( 'pp-cancel-button-label' 
)->escaped();
                $output->addModules( 'ext.translate.pagepreparation' );
                $output->addModuleStyles( 'jquery.uls.grid' );
                $param = $request->getText( 'param' );
@@ -39,6 +40,8 @@
                        {$prepareButtonValue}</button>
                <button id="action-save" class="mw-ui-button mw-ui-constructive 
hide" type="button">
                        {$saveButtonValue}</button>
+               <button id="action-cancel" class="mw-ui-button mw-ui-quiet 
hide" type="button">
+                       {$cancelButtonValue}</button>
        </form>
        <div class="messageDiv hide"></div>
        <div class="divDiff hide">

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1766914018bcde695490e40554feae9f473b463a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: BPositive <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to