mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 06:46:26 +00:00
36 lines
1,015 B
JavaScript
36 lines
1,015 B
JavaScript
|
/*!
|
||
|
* VisualEditor UserInterface MWTemplateMenuOptionWidget class
|
||
|
*
|
||
|
* @copyright 2011-2015 VisualEditor Team and others; see http://ve.mit-license.org
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* Creates a ve.ui.MWTemplateMenuOptionWidget object.
|
||
|
*
|
||
|
* @class
|
||
|
* @extends OO.ui.MenuOptionWidget
|
||
|
*
|
||
|
* @constructor
|
||
|
* @param {Object} [config] Configuration options
|
||
|
* @cfg {string} [templateName] Template name
|
||
|
* @cfg {string} [templateDescription] Template description
|
||
|
*/
|
||
|
ve.ui.MWTemplateMenuOptionWidget = function VeUiMWTemplateMenuOptionWidget( config ) {
|
||
|
// Configuration initialization
|
||
|
config = $.extend( { icon: 'check', data: config.templateName }, config );
|
||
|
|
||
|
// Parent constructor
|
||
|
ve.ui.MWTemplateMenuOptionWidget.super.call( this, config );
|
||
|
|
||
|
if ( config.templateDescription ) {
|
||
|
$( '<div>' )
|
||
|
.addClass( 've-ui-mwTemplateMenuOptionWidget-description' )
|
||
|
.text( config.templateDescription )
|
||
|
.appendTo( this.$element );
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/* Inheritance */
|
||
|
|
||
|
OO.inheritClass( ve.ui.MWTemplateMenuOptionWidget, OO.ui.MenuOptionWidget );
|