2016-12-18 19:04:20 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor user interface MWTemplatesUsedPage class.
|
|
|
|
*
|
|
|
|
* @copyright 2011-2016 VisualEditor Team and others; see AUTHORS.txt
|
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MediaWiki meta dialog TemplatesUsed page.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends OO.ui.PageLayout
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {string} name Unique symbolic name of page
|
|
|
|
* @param {Object} [config] Configuration options
|
2018-04-04 20:37:32 +00:00
|
|
|
* @cfg {jQuery} [$overlay] Overlay to render dropdowns in
|
2016-12-18 19:04:20 +00:00
|
|
|
*/
|
|
|
|
ve.ui.MWTemplatesUsedPage = function VeUiMWTemplatesUsedPage() {
|
|
|
|
// Parent constructor
|
|
|
|
ve.ui.MWTemplatesUsedPage.super.apply( this, arguments );
|
|
|
|
|
|
|
|
// Properties
|
|
|
|
this.templatesUsedFieldset = new OO.ui.FieldsetLayout( {
|
|
|
|
label: ve.msg( 'visualeditor-templatesused-tool' ),
|
2017-07-06 16:52:56 +00:00
|
|
|
icon: 'puzzle'
|
2016-12-18 19:04:20 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
if ( ve.init.target.$templatesUsed && ve.init.target.$templatesUsed.find( 'li' ).length ) {
|
|
|
|
this.templatesUsedFieldset.$element.append(
|
2018-11-28 22:42:19 +00:00
|
|
|
ve.init.target.$templatesUsed.clone()
|
2016-12-18 19:04:20 +00:00
|
|
|
);
|
2018-11-28 22:42:19 +00:00
|
|
|
ve.targetLinksToNewWindow( this.templatesUsedFieldset.$element[ 0 ] );
|
2016-12-18 19:04:20 +00:00
|
|
|
} else {
|
|
|
|
this.templatesUsedFieldset.$element.append(
|
|
|
|
$( '<em>' ).text( ve.msg( 'visualeditor-dialog-meta-templatesused-noresults' ) )
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Initialization
|
|
|
|
this.$element.append( this.templatesUsedFieldset.$element );
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
OO.inheritClass( ve.ui.MWTemplatesUsedPage, OO.ui.PageLayout );
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.ui.MWTemplatesUsedPage.prototype.setOutlineItem = function () {
|
|
|
|
// Parent method
|
|
|
|
ve.ui.MWTemplatesUsedPage.super.prototype.setOutlineItem.apply( this, arguments );
|
|
|
|
|
|
|
|
if ( this.outlineItem ) {
|
|
|
|
this.outlineItem
|
2017-07-06 16:52:56 +00:00
|
|
|
.setIcon( 'puzzle' )
|
2016-12-18 19:04:20 +00:00
|
|
|
.setLabel( ve.msg( 'visualeditor-templatesused-tool' ) );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.ui.MWTemplatesUsedPage.prototype.focus = function () {
|
|
|
|
// No controls, just focus the whole page instead of the first link
|
|
|
|
this.$element.focus();
|
|
|
|
};
|
2018-10-28 19:18:40 +00:00
|
|
|
|
|
|
|
ve.ui.MWTemplatesUsedPage.prototype.getFieldsets = function () {
|
|
|
|
return [
|
|
|
|
this.templatesUsedFieldset
|
|
|
|
];
|
|
|
|
};
|