mediawiki-extensions-Visual.../modules/ve-mw/ui/widgets/ve.ui.MWTemplateMenuOptionWidget.js
Moriel Schottlender a669a4fc52 Show template description in the template search
For each template result, ask for the templatedata description. If
that description exists, show it under the template result.

Bug: T53436
Change-Id: If28d1eb082edca6f50c6c15c933a0b7d014eaeaf
2015-04-16 12:30:55 -07:00

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 );