Mattflaschen has uploaded a new change for review.

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


Change subject: Make shouldSkip functions for common actions (edit and submit).
......................................................................

Make shouldSkip functions for common actions (edit and submit).

Change-Id: I32278c4e6d36376e3909aa4c9d20c68933eb1126
---
M modules/ext.guidedTour.lib.js
M modules/tours/gettingstarted.js
2 files changed, 23 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GuidedTour 
refs/changes/90/60790/1

diff --git a/modules/ext.guidedTour.lib.js b/modules/ext.guidedTour.lib.js
index 180a91f..a998ae9 100644
--- a/modules/ext.guidedTour.lib.js
+++ b/modules/ext.guidedTour.lib.js
@@ -926,6 +926,25 @@
                },
 
                /**
+                * Checks whether they are editing.  Does not include 
previewing.
+                *
+                * @return {boolean} true if and only if they are on the edit 
action
+                */
+               isEditing: function () {
+                       return mw.config.get( 'wgAction' ) === 'edit';
+               },
+
+               /**
+                * Checks whether they are previewing or reviewing changes 
(after clicking "Show changes")
+                *
+                * @return {boolean} true if and only if they are reviewing
+                */
+               isReviewing: function () {
+                       return mw.config.get( 'wgAction' ) === 'submit';
+               },
+
+
+               /**
                 * Checks whether they just saved an edit.
                 *
                 * @return {boolean} true if they just saved an edit, false 
otherwise
diff --git a/modules/tours/gettingstarted.js b/modules/tours/gettingstarted.js
index 4b1e586..9af5671 100644
--- a/modules/tours/gettingstarted.js
+++ b/modules/tours/gettingstarted.js
@@ -62,18 +62,13 @@
                } ],
 
                // TODO (mattflaschen 2013-02-05): Factor out into lib.  Also, 
it should probably use wgAction, rather than query.
-               shouldSkip: function() {
-                       // If they're already editing, skip
-                       return gt.hasQuery( { action: 'edit' } );
-               }
+               shouldSkip: gt.isEditing
        },  {
                titlemsg: 'guidedtour-tour-gettingstarted-click-edit-title',
                descriptionmsg: 
'guidedtour-tour-gettingstarted-click-edit-description',
                attachTo: '#ca-edit',
                position: 'bottom',
-               shouldSkip: function() {
-                       return gt.hasQuery( { action: 'edit' } );
-               }
+               shouldSkip: gt.isEditing
        }, {
                titlemsg: 'guidedtour-tour-gettingstarted-click-preview-title',
                descriptionmsg: 
'guidedtour-tour-gettingstarted-click-preview-description',
@@ -81,7 +76,7 @@
                position: 'top',
                closeOnClickOutside: false,
                shouldSkip: function() {
-                       return !gt.hasQuery( { action: 'edit' } );
+                       return !gt.isEditing();
                }
        }, {
                titlemsg: 'guidedtour-tour-gettingstarted-click-save-title',
@@ -90,8 +85,7 @@
                position: 'top',
                closeOnClickOutside: false,
                shouldSkip: function() {
-                       // If they're not previewing or doing show changes, skip
-                       return !gt.hasQuery( { action: 'submit' } );
+                       return !gt.isReviewing();
                }
        }, {
                titlemsg: 'guidedtour-tour-gettingstarted-end-title',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I32278c4e6d36376e3909aa4c9d20c68933eb1126
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GuidedTour
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>

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

Reply via email to