jenkins-bot has submitted this change and it was merged.
Change subject: Support programmatic tool titles
......................................................................
Support programmatic tool titles
Just override OO.ui.Tool.prototype.getTitle. The default implementation
uses the same static property as before.
Change-Id: I80fd95142cafac0e136cfe3031c16c371625b469
---
M modules/oojs-ui/OO.ui.Tool.js
1 file changed, 12 insertions(+), 2 deletions(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/oojs-ui/OO.ui.Tool.js b/modules/oojs-ui/OO.ui.Tool.js
index 2bbb30a..795154d 100644
--- a/modules/oojs-ui/OO.ui.Tool.js
+++ b/modules/oojs-ui/OO.ui.Tool.js
@@ -198,6 +198,17 @@
};
/**
+ * Get the tool title.
+ *
+ * @method
+ * @returns {string} [title] Title text
+ */
+OO.ui.Tool.prototype.getTitle = function () {
+ var key = this.constructor.static.titleMessage;
+ return typeof key === 'string' ? OO.ui.msg( key ) : '';
+};
+
+/**
* Get the tool's symbolic name.
*
* @method
@@ -213,10 +224,9 @@
* @method
*/
OO.ui.Tool.prototype.updateLabel = function () {
- var titleMessage = this.constructor.static.titleMessage,
+ var title = this.getTitle(),
labelTooltips = this.toolGroup.constructor.static.labelTooltips,
accelTooltips = this.toolGroup.constructor.static.accelTooltips,
- title = titleMessage ? OO.ui.msg( titleMessage ) : '',
accel = this.toolbar.getToolAccelerator(
this.constructor.static.name ),
tooltipParts = [];
--
To view, visit https://gerrit.wikimedia.org/r/90376
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I80fd95142cafac0e136cfe3031c16c371625b469
Gerrit-PatchSet: 11
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Trevor Parscal <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits