jenkins-bot has submitted this change and it was merged.
Change subject: Allow suppressing the automatic okay button.
......................................................................
Allow suppressing the automatic okay button.
Change-Id: Ibefa3d67621d528e915d7eda6011b994e02703a4
---
M modules/ext.guidedTour.lib.js
1 file changed, 22 insertions(+), 12 deletions(-)
Approvals:
Spage: Checked; Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ext.guidedTour.lib.js b/modules/ext.guidedTour.lib.js
index 4b9a373..236c23c 100644
--- a/modules/ext.guidedTour.lib.js
+++ b/modules/ext.guidedTour.lib.js
@@ -311,11 +311,12 @@
*
* @param {Array} [buttonSpecs=[]] Button specifications as used in
tour. Elements
* will be mutated.
+ * @param {boolean} allowAutomaticOkay true if and only if an okay can
be generated
*
* @return {Array} Array of button specifications that Guiders expects
* @throws {mw.guidedTour.TourDefinitionError} On invalid actions
*/
- function getButtons( buttonSpecs ) {
+ function getButtons( buttonSpecs, allowAutomaticOkay ) {
var i, okayButton, nextButton, guiderButtons, currentButton,
url;
function next() {
@@ -364,13 +365,15 @@
}
}
- // Ensure there is always an okay and/or next button. In some
cases, there will not be
- // a next, since the user is prompted to do something else
- // (e.g. click 'Edit')
- if ( okayButton === undefined && nextButton === undefined ) {
- okayButton = getMessageButton( 'okay', function () {
- gt.hideAll();
- } );
+ if ( allowAutomaticOkay ) {
+ // Ensure there is always an okay and/or next button.
In some cases, there will not be
+ // a next, since the user is prompted to do something
else
+ // (e.g. click 'Edit')
+ if ( okayButton === undefined && nextButton ===
undefined ) {
+ okayButton = getMessageButton( 'okay', function
() {
+ gt.hideAll();
+ } );
+ }
}
if ( okayButton !== undefined ) {
@@ -397,7 +400,8 @@
*/
function augmentGuider( defaultOptions, options ) {
return $.extend( true, {
- onClose: $.noop
+ onClose: $.noop,
+ allowAutomaticOkay: true
}, defaultOptions, options );
}
@@ -493,7 +497,8 @@
}
delete options.descriptionmsg;
- options.buttons = getButtons( options.buttons );
+ options.buttons = getButtons( options.buttons,
options.allowAutomaticOkay );
+ delete options.allowAutomaticOkay;
if ( options.attachTo !== undefined ) {
options.attachTo = getValueForSkin( options, 'attachTo'
);
@@ -956,8 +961,8 @@
* will occur.
*
* If there would otherwise be neither an Okay nor a Next
button on a
- * particular guider, it will have an Okay button. This will
hide the
- * guider if clicked.
+ * particular guider, it will have an Okay button
+ * (but see allowAutomaticOkay). This will hide the guider if
clicked.
*
* If input to defineTour is invalid, it will throw
* mw.guidedTour.TourDefinitionError.
@@ -1021,6 +1026,11 @@
* - gt.getPageAsDescription - Treat description as the name
of a description
* page on the wiki
*
+ * @param {boolean} [tourSpec.steps.allowAutomaticOkay=true] By
default, if
+ * you do not specify an Okay or Next button, an Okay button
will be generated.
+ *
+ * To suppress this, set allowAutomaticOkay to false for the
guider.
+ *
* @param {boolean} [tourSpec.steps.closeOnClickOutside=true]
Close the
* guider when the user clicks elsewhere on screen
*
--
To view, visit https://gerrit.wikimedia.org/r/63831
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibefa3d67621d528e915d7eda6011b994e02703a4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GuidedTour
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Spage <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits