Mattflaschen has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/352707 )
Change subject: Support providing custom text instead of using the default action icon ...................................................................... Support providing custom text instead of using the default action icon Also support namemsg here. Change-Id: I67988c149ae3c3521e4fe473f99ce0f76243f389 --- M modules/ext.guidedTour.lib/ext.guidedTour.lib.Step.js 1 file changed, 19 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GuidedTour refs/changes/07/352707/1 diff --git a/modules/ext.guidedTour.lib/ext.guidedTour.lib.Step.js b/modules/ext.guidedTour.lib/ext.guidedTour.lib.Step.js index be33c80..0490351 100644 --- a/modules/ext.guidedTour.lib/ext.guidedTour.lib.Step.js +++ b/modules/ext.guidedTour.lib/ext.guidedTour.lib.Step.js @@ -171,8 +171,11 @@ }; /** - * Gets a Guiders button specification, using the message for the provided type - * (if no text is provided) and the provided callback. + * Gets a Guiders button specification, using the message and icon for the provided + * type (if no text is provided) and the provided callback. + * + * If a name or namemsg is provided, the icon will not be shown and the text will + * be used. * * @private * @@ -192,7 +195,8 @@ // button.action will be deleted with the delete operator later in the flow. buttonAction = button.action, buttonTypeClass = getButtonTypeClass( button ), - messageKeyMapping; + messageKeyMapping, + hasIcon; messageKeyMapping = { next: 'guidedtour-next-button', @@ -201,9 +205,19 @@ end: 'guidedtour-okay-button' }; - if ( !button.name ) { + // TODO: Refactor how namemsg is handled, for code reuse. + if ( button.namemsg ) { + messageKey = button.namemsg; + button.name = mw.message( button.namemsg ).parse(); + delete button.namemsg; + } + + if ( button.name ) { + hasIcon = false; + } else { messageKey = messageKeyMapping[button.action]; button.name = mw.message( messageKey ).parse(); + hasIcon = true; } return { @@ -226,7 +240,7 @@ html: { 'class': guiders._buttonClass + ' ' + actionButtonClass + ' ' + buttonTypeClass }, - hasIcon: true + hasIcon: hasIcon }; }; -- To view, visit https://gerrit.wikimedia.org/r/352707 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I67988c149ae3c3521e4fe473f99ce0f76243f389 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/GuidedTour Gerrit-Branch: master Gerrit-Owner: Mattflaschen <mflasc...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits