mediawiki-extensions-Visual.../modules/ve-mw/ui/pages/ve.ui.MWTemplatesUsedPage.js
flutters 79253bb0c8 ve.ui.MWMetaDialog: "Apply changes" is now only enabled after making changes
Added 5 methods for MetaDialog (documented in code comments)
extractSettings
compareSettings
getAllWidgets
assignEvents
updateActions

Added 2 fields to MetaDialog
oldSettings
widgetList

Apply changes button now is only enabled when there are new changes

Added getFieldsets method to all subpages

Bug: T207719
Change-Id: Id51acf6c754d9a2572811775d83983e6ab9395b7
2018-10-30 19:12:52 +00:00

78 lines
2 KiB
JavaScript

/*!
* 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
* @cfg {jQuery} [$overlay] Overlay to render dropdowns in
*/
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' ),
icon: 'puzzle'
} );
if ( ve.init.target.$templatesUsed && ve.init.target.$templatesUsed.find( 'li' ).length ) {
this.templatesUsedFieldset.$element.append(
ve.init.target.$templatesUsed.clone().find( 'a' ).each( function () {
$( this ).attr( 'target', '_blank' ).attr( 'rel', 'noopener' );
} ).end()
);
} 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
.setIcon( 'puzzle' )
.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();
};
ve.ui.MWTemplatesUsedPage.prototype.getFieldsets = function () {
return [
this.templatesUsedFieldset
];
};