2013-11-15 20:36:53 +00:00
|
|
|
|
/*!
|
|
|
|
|
* VisualEditor user interface MWAdvancedSettingsPage class.
|
|
|
|
|
*
|
2014-03-25 01:36:51 +00:00
|
|
|
|
* @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
|
2013-11-15 20:36:53 +00:00
|
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* MediaWiki meta dialog advanced settings page.
|
|
|
|
|
*
|
|
|
|
|
* @class
|
|
|
|
|
* @extends OO.ui.PageLayout
|
|
|
|
|
*
|
|
|
|
|
* @constructor
|
|
|
|
|
* @param {string} name Unique symbolic name of page
|
|
|
|
|
* @param {Object} [config] Configuration options
|
|
|
|
|
*/
|
2014-04-04 17:42:13 +00:00
|
|
|
|
ve.ui.MWAdvancedSettingsPage = function VeUiMWAdvancedSettingsPage( name, config ) {
|
2014-04-15 14:09:48 +00:00
|
|
|
|
var advancedSettingsPage = this;
|
|
|
|
|
|
2013-11-15 20:36:53 +00:00
|
|
|
|
// Parent constructor
|
|
|
|
|
OO.ui.PageLayout.call( this, name, config );
|
|
|
|
|
|
|
|
|
|
// Properties
|
2014-04-04 17:42:13 +00:00
|
|
|
|
this.metaList = null;
|
2013-11-15 20:36:53 +00:00
|
|
|
|
this.indexingOptionTouched = false;
|
2013-11-15 20:50:15 +00:00
|
|
|
|
this.newSectionEditLinkOptionTouched = false;
|
|
|
|
|
|
2013-11-15 20:36:53 +00:00
|
|
|
|
this.advancedSettingsFieldset = new OO.ui.FieldsetLayout( {
|
2014-08-22 20:50:48 +00:00
|
|
|
|
$: this.$,
|
|
|
|
|
label: ve.msg( 'visualeditor-dialog-meta-advancedsettings-label' ),
|
|
|
|
|
icon: 'advanced'
|
2013-11-15 20:36:53 +00:00
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
// Initialization
|
|
|
|
|
|
|
|
|
|
// Indexing items
|
2014-02-20 03:32:50 +00:00
|
|
|
|
this.indexing = new OO.ui.FieldLayout(
|
2014-08-22 20:50:48 +00:00
|
|
|
|
new OO.ui.ButtonSelectWidget( { $: this.$ } )
|
2014-02-20 03:32:50 +00:00
|
|
|
|
.addItems( [
|
2014-11-22 01:40:00 +00:00
|
|
|
|
new OO.ui.ButtonOptionWidget( {
|
|
|
|
|
data: 'mwIndexForce',
|
|
|
|
|
label: ve.msg( 'visualeditor-dialog-meta-settings-index-force' )
|
|
|
|
|
} ),
|
|
|
|
|
new OO.ui.ButtonOptionWidget( {
|
|
|
|
|
data: 'default',
|
|
|
|
|
label: ve.msg( 'visualeditor-dialog-meta-settings-index-default' )
|
|
|
|
|
} ),
|
|
|
|
|
new OO.ui.ButtonOptionWidget( {
|
|
|
|
|
data: 'mwIndexDisable',
|
|
|
|
|
label: ve.msg( 'visualeditor-dialog-meta-settings-index-disable' )
|
|
|
|
|
} )
|
2014-02-20 03:32:50 +00:00
|
|
|
|
] )
|
2014-08-22 20:50:48 +00:00
|
|
|
|
.connect( this, { select: 'onIndexingOptionChange' } ),
|
2014-02-20 03:32:50 +00:00
|
|
|
|
{
|
2014-08-22 20:50:48 +00:00
|
|
|
|
$: this.$,
|
|
|
|
|
align: 'top',
|
2014-09-15 01:18:03 +00:00
|
|
|
|
label: ve.msg( 'visualeditor-dialog-meta-settings-index-label' ),
|
|
|
|
|
help: ve.msg( 'visualeditor-dialog-meta-settings-index-help' )
|
2014-02-20 03:32:50 +00:00
|
|
|
|
}
|
2013-11-15 20:36:53 +00:00
|
|
|
|
);
|
|
|
|
|
|
2013-11-15 20:50:15 +00:00
|
|
|
|
// New edit section link items
|
2014-02-20 03:32:50 +00:00
|
|
|
|
this.newEditSectionLink = new OO.ui.FieldLayout(
|
2014-08-22 20:50:48 +00:00
|
|
|
|
new OO.ui.ButtonSelectWidget( { $: this.$ } )
|
2014-02-20 03:32:50 +00:00
|
|
|
|
.addItems( [
|
2014-11-22 01:40:00 +00:00
|
|
|
|
new OO.ui.ButtonOptionWidget( {
|
|
|
|
|
data: 'mwNewSectionEditForce',
|
|
|
|
|
label: ve.msg( 'visualeditor-dialog-meta-settings-newsectioneditlink-force' )
|
|
|
|
|
} ),
|
|
|
|
|
new OO.ui.ButtonOptionWidget( {
|
|
|
|
|
data: 'default',
|
|
|
|
|
label: ve.msg( 'visualeditor-dialog-meta-settings-newsectioneditlink-default' )
|
|
|
|
|
} ),
|
|
|
|
|
new OO.ui.ButtonOptionWidget( {
|
|
|
|
|
data: 'mwNewSectionEditDisable',
|
|
|
|
|
label: ve.msg( 'visualeditor-dialog-meta-settings-newsectioneditlink-disable' )
|
|
|
|
|
} )
|
2014-02-20 03:32:50 +00:00
|
|
|
|
] )
|
2014-08-22 20:50:48 +00:00
|
|
|
|
.connect( this, { select: 'onNewSectionEditLinkOptionChange' } ),
|
2014-02-20 03:32:50 +00:00
|
|
|
|
{
|
2014-08-22 20:50:48 +00:00
|
|
|
|
$: this.$,
|
|
|
|
|
align: 'top',
|
2014-09-15 01:18:03 +00:00
|
|
|
|
label: ve.msg( 'visualeditor-dialog-meta-settings-newsectioneditlink-label' ),
|
2014-11-26 21:18:34 +00:00
|
|
|
|
help: ve.msg( 'visualeditor-dialog-meta-settings-newsectioneditlink-help', $( '#ca-edit' ).text() )
|
2014-02-20 03:32:50 +00:00
|
|
|
|
}
|
2013-11-15 20:50:15 +00:00
|
|
|
|
);
|
|
|
|
|
|
2014-04-22 21:07:13 +00:00
|
|
|
|
this.displayTitleTouched = false;
|
2014-12-09 21:01:13 +00:00
|
|
|
|
this.enableDisplayTitleCheckbox = new OO.ui.CheckboxInputWidget( { $: this.$ } );
|
|
|
|
|
this.enableDisplayTitleCheckbox.connect( this, { change: 'onEnableDisplayTitleCheckboxChange' } );
|
2014-04-22 21:07:13 +00:00
|
|
|
|
this.enableDisplayTitleField = new OO.ui.FieldLayout(
|
2014-12-09 21:01:13 +00:00
|
|
|
|
this.enableDisplayTitleCheckbox,
|
2014-04-22 21:07:13 +00:00
|
|
|
|
{
|
2014-08-22 20:50:48 +00:00
|
|
|
|
$: this.$,
|
|
|
|
|
align: 'inline',
|
2014-09-15 01:18:03 +00:00
|
|
|
|
label: ve.msg( 'visualeditor-dialog-meta-settings-displaytitle-enable' ),
|
|
|
|
|
help: ve.msg( 'visualeditor-dialog-meta-settings-displaytitle-help' )
|
2014-04-22 21:07:13 +00:00
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
this.displayTitleInput = new OO.ui.TextInputWidget( {
|
2014-08-22 20:50:48 +00:00
|
|
|
|
$: this.$,
|
|
|
|
|
placeholder: ve.msg( 'visualeditor-dialog-meta-settings-displaytitle' )
|
2014-04-22 21:07:13 +00:00
|
|
|
|
} );
|
2014-08-22 20:50:48 +00:00
|
|
|
|
this.displayTitleInput.connect( this, { change: 'onDisplayTitleInputChange' } );
|
2014-04-22 21:07:13 +00:00
|
|
|
|
this.displayTitleField = new OO.ui.FieldLayout(
|
|
|
|
|
this.displayTitleInput,
|
|
|
|
|
{
|
2014-08-22 20:50:48 +00:00
|
|
|
|
$: this.$,
|
|
|
|
|
align: 'inline'
|
2014-04-22 21:07:13 +00:00
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
this.advancedSettingsFieldset.addItems( [ this.indexing, this.newEditSectionLink, this.enableDisplayTitleField, this.displayTitleField ] );
|
|
|
|
|
|
2014-04-15 14:09:48 +00:00
|
|
|
|
this.metaItemCheckboxes = [];
|
|
|
|
|
if ( mw.config.get( 'wgVariantArticlePath' ) ) {
|
|
|
|
|
this.metaItemCheckboxes.push(
|
|
|
|
|
{
|
|
|
|
|
metaName: 'mwNoContentConvert',
|
2014-09-15 01:18:03 +00:00
|
|
|
|
label: ve.msg( 'visualeditor-dialog-meta-settings-nocontentconvert-label' ),
|
|
|
|
|
help: ve.msg( 'visualeditor-dialog-meta-settings-nocontentconvert-help' )
|
2014-04-15 14:09:48 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
metaName: 'mwNoTitleConvert',
|
2014-09-15 01:18:03 +00:00
|
|
|
|
label: ve.msg( 'visualeditor-dialog-meta-settings-notitleconvert-label' ),
|
|
|
|
|
help: ve.msg( 'visualeditor-dialog-meta-settings-notitleconvert-help' )
|
2014-04-15 14:09:48 +00:00
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$.each( this.metaItemCheckboxes, function () {
|
|
|
|
|
this.fieldLayout = new OO.ui.FieldLayout(
|
2014-08-22 20:50:48 +00:00
|
|
|
|
new OO.ui.CheckboxInputWidget( { $: this.$ } ),
|
2014-04-15 14:09:48 +00:00
|
|
|
|
{
|
2014-08-22 20:50:48 +00:00
|
|
|
|
$: advancedSettingsPage.$,
|
|
|
|
|
align: 'inline',
|
|
|
|
|
label: this.label
|
2014-04-15 14:09:48 +00:00
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
advancedSettingsPage.advancedSettingsFieldset.addItems( [ this.fieldLayout ] );
|
|
|
|
|
} );
|
|
|
|
|
|
2013-11-15 20:36:53 +00:00
|
|
|
|
this.$element.append( this.advancedSettingsFieldset.$element );
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
|
|
OO.inheritClass( ve.ui.MWAdvancedSettingsPage, OO.ui.PageLayout );
|
|
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
2014-04-22 21:07:13 +00:00
|
|
|
|
/**
|
|
|
|
|
* Handle redirect state change events.
|
|
|
|
|
*
|
|
|
|
|
* @param {boolean} value Whether a redirect is to be set for this page
|
|
|
|
|
*/
|
2014-12-09 21:01:13 +00:00
|
|
|
|
ve.ui.MWAdvancedSettingsPage.prototype.onEnableDisplayTitleCheckboxChange = function ( value ) {
|
2014-04-22 21:07:13 +00:00
|
|
|
|
this.displayTitleInput.setDisabled( !value );
|
|
|
|
|
if ( !value ) {
|
|
|
|
|
this.displayTitleInput.setValue( '' );
|
2014-12-09 21:01:13 +00:00
|
|
|
|
this.enableDisplayTitleCheckbox.setSelected( false );
|
2014-04-22 21:07:13 +00:00
|
|
|
|
}
|
|
|
|
|
this.displayTitleTouched = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Handle redirect state change events.
|
|
|
|
|
*
|
|
|
|
|
* @param {boolean} value Whether a redirect is to be set for this page
|
|
|
|
|
*/
|
|
|
|
|
ve.ui.MWAdvancedSettingsPage.prototype.onDisplayTitleInputChange = function () {
|
|
|
|
|
this.displayTitleTouched = true;
|
|
|
|
|
};
|
|
|
|
|
|
2013-11-15 20:36:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* @inheritdoc
|
|
|
|
|
*/
|
|
|
|
|
ve.ui.MWAdvancedSettingsPage.prototype.setOutlineItem = function ( outlineItem ) {
|
|
|
|
|
// Parent method
|
|
|
|
|
OO.ui.PageLayout.prototype.setOutlineItem.call( this, outlineItem );
|
|
|
|
|
|
|
|
|
|
if ( this.outlineItem ) {
|
|
|
|
|
this.outlineItem
|
|
|
|
|
.setIcon( 'advanced' )
|
|
|
|
|
.setLabel( ve.msg( 'visualeditor-dialog-meta-advancedsettings-section' ) );
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Indexing option methods */
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Handle indexing option state change events.
|
|
|
|
|
*/
|
|
|
|
|
ve.ui.MWAdvancedSettingsPage.prototype.onIndexingOptionChange = function () {
|
|
|
|
|
this.indexingOptionTouched = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
2014-04-15 14:09:48 +00:00
|
|
|
|
* Get the first meta item of a given name
|
2013-11-15 20:36:53 +00:00
|
|
|
|
*
|
2014-04-15 14:09:48 +00:00
|
|
|
|
* @param {string} name Name of the meta item
|
|
|
|
|
* @returns {Object|null} Meta item, if any
|
2013-11-15 20:36:53 +00:00
|
|
|
|
*/
|
2014-04-15 14:09:48 +00:00
|
|
|
|
ve.ui.MWAdvancedSettingsPage.prototype.getMetaItem = function ( name ) {
|
|
|
|
|
return this.metaList.getItemsInGroup( name )[0] || null;
|
2013-11-15 20:36:53 +00:00
|
|
|
|
};
|
|
|
|
|
|
2013-11-15 20:50:15 +00:00
|
|
|
|
/* New edit section link option methods */
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Handle new edit section link change events.
|
|
|
|
|
*/
|
|
|
|
|
ve.ui.MWAdvancedSettingsPage.prototype.onNewSectionEditLinkOptionChange = function () {
|
|
|
|
|
this.newSectionEditLinkOptionTouched = true;
|
|
|
|
|
};
|
|
|
|
|
|
2013-11-15 20:36:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* Setup settings page.
|
|
|
|
|
*
|
2014-04-04 17:42:13 +00:00
|
|
|
|
* @param {ve.dm.MetaList} metaList Meta list
|
2013-11-15 20:36:53 +00:00
|
|
|
|
* @param {Object} [data] Dialog setup data
|
|
|
|
|
*/
|
2014-04-04 17:42:13 +00:00
|
|
|
|
ve.ui.MWAdvancedSettingsPage.prototype.setup = function ( metaList ) {
|
|
|
|
|
this.metaList = metaList;
|
|
|
|
|
|
2013-11-15 20:36:53 +00:00
|
|
|
|
var // Indexing items
|
2014-02-20 03:32:50 +00:00
|
|
|
|
indexingField = this.indexing.getField(),
|
2014-04-15 14:09:48 +00:00
|
|
|
|
indexingOption = this.getMetaItem( 'mwIndex' ),
|
2013-11-15 20:50:15 +00:00
|
|
|
|
indexingType = indexingOption && indexingOption.element.type || 'default',
|
|
|
|
|
|
|
|
|
|
// New section edit link items
|
2014-02-20 03:32:50 +00:00
|
|
|
|
newSectionEditField = this.newEditSectionLink.getField(),
|
2014-04-15 14:09:48 +00:00
|
|
|
|
newSectionEditLinkOption = this.getMetaItem( 'mwNewSectionEdit' ),
|
|
|
|
|
newSectionEditLinkType = newSectionEditLinkOption && newSectionEditLinkOption.element.type || 'default',
|
|
|
|
|
|
2014-04-22 21:07:13 +00:00
|
|
|
|
displayTitleItem = this.getMetaItem( 'mwDisplayTitle' ),
|
|
|
|
|
displayTitle = displayTitleItem && displayTitleItem.getAttribute( 'content' ) || '',
|
|
|
|
|
|
2014-04-15 14:09:48 +00:00
|
|
|
|
advancedSettingsPage = this;
|
2013-11-15 20:36:53 +00:00
|
|
|
|
|
|
|
|
|
// Indexing items
|
2014-02-20 03:32:50 +00:00
|
|
|
|
indexingField.selectItem( indexingField.getItemFromData( indexingType ) );
|
2013-11-15 20:36:53 +00:00
|
|
|
|
this.indexingOptionTouched = false;
|
2013-11-15 20:50:15 +00:00
|
|
|
|
|
|
|
|
|
// New section edit link items
|
2014-02-20 03:32:50 +00:00
|
|
|
|
newSectionEditField.selectItem( newSectionEditField.getItemFromData( newSectionEditLinkType ) );
|
2013-11-15 20:50:15 +00:00
|
|
|
|
this.newSectionEditLinkOptionTouched = false;
|
2014-04-15 14:09:48 +00:00
|
|
|
|
|
2014-12-09 21:01:13 +00:00
|
|
|
|
this.enableDisplayTitleCheckbox.setSelected( !!displayTitleItem );
|
2014-04-22 21:07:13 +00:00
|
|
|
|
this.displayTitleInput.setValue( displayTitle );
|
|
|
|
|
this.displayTitleInput.setDisabled( !displayTitle );
|
|
|
|
|
this.displayTitleTouched = false;
|
|
|
|
|
|
2014-04-15 14:09:48 +00:00
|
|
|
|
// Simple checkbox items
|
|
|
|
|
$.each( this.metaItemCheckboxes, function () {
|
2014-12-09 21:01:13 +00:00
|
|
|
|
var isSelected = !!advancedSettingsPage.getMetaItem( this.metaName );
|
|
|
|
|
this.fieldLayout.getField().setSelected( isSelected );
|
2014-04-15 14:09:48 +00:00
|
|
|
|
} );
|
2013-11-15 20:36:53 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tear down settings page.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} [data] Dialog tear down data
|
|
|
|
|
*/
|
|
|
|
|
ve.ui.MWAdvancedSettingsPage.prototype.teardown = function ( data ) {
|
|
|
|
|
// Data initialization
|
|
|
|
|
data = data || {};
|
|
|
|
|
|
|
|
|
|
var // Indexing items
|
2014-04-15 14:09:48 +00:00
|
|
|
|
currentIndexingItem = this.getMetaItem( 'mwIndex' ),
|
2014-02-20 03:32:50 +00:00
|
|
|
|
newIndexingData = this.indexing.getField().getSelectedItem(),
|
2013-11-15 20:50:15 +00:00
|
|
|
|
|
|
|
|
|
// New section edit link items
|
2014-04-15 14:09:48 +00:00
|
|
|
|
currentNewSectionEditLinkItem = this.getMetaItem( 'mwNewSectionEdit' ),
|
|
|
|
|
newNewSectionEditLinkOptionData = this.newEditSectionLink.getField().getSelectedItem(),
|
|
|
|
|
|
2014-04-22 21:07:13 +00:00
|
|
|
|
currentDisplayTitleItem = this.getMetaItem( 'mwDisplayTitle' ),
|
|
|
|
|
newDisplayTitle = this.displayTitleInput.getValue(),
|
2014-08-22 20:50:48 +00:00
|
|
|
|
newDisplayTitleItemData = { type: 'mwDisplayTitle', attributes: { content: newDisplayTitle } },
|
2014-04-22 21:07:13 +00:00
|
|
|
|
|
2014-04-15 14:09:48 +00:00
|
|
|
|
advancedSettingsPage = this;
|
2013-11-15 20:36:53 +00:00
|
|
|
|
|
|
|
|
|
// Alter the indexing option flag iff it's been touched & is actually different
|
|
|
|
|
if ( this.indexingOptionTouched ) {
|
|
|
|
|
if ( newIndexingData.data === 'default' ) {
|
|
|
|
|
if ( currentIndexingItem ) {
|
|
|
|
|
currentIndexingItem.remove();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if ( !currentIndexingItem ) {
|
2014-08-22 20:50:48 +00:00
|
|
|
|
this.metaList.insertMeta( { type: newIndexingData.data } );
|
2013-11-15 20:36:53 +00:00
|
|
|
|
} else if ( currentIndexingItem.element.type !== newIndexingData.data ) {
|
|
|
|
|
currentIndexingItem.replaceWith(
|
|
|
|
|
ve.extendObject( true, {},
|
|
|
|
|
currentIndexingItem.getElement(),
|
2014-08-22 20:50:48 +00:00
|
|
|
|
{ type: newIndexingData.data }
|
2013-11-15 20:36:53 +00:00
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-15 20:50:15 +00:00
|
|
|
|
// Alter the new section edit option flag iff it's been touched & is actually different
|
|
|
|
|
if ( this.newSectionEditLinkOptionTouched ) {
|
|
|
|
|
if ( newNewSectionEditLinkOptionData.data === 'default' ) {
|
|
|
|
|
if ( currentNewSectionEditLinkItem ) {
|
|
|
|
|
currentNewSectionEditLinkItem.remove();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if ( !currentNewSectionEditLinkItem ) {
|
2014-08-22 20:50:48 +00:00
|
|
|
|
this.metaList.insertMeta( { type: newNewSectionEditLinkOptionData.data } );
|
2013-11-15 20:50:15 +00:00
|
|
|
|
} else if ( currentNewSectionEditLinkItem.element.type !== newNewSectionEditLinkOptionData.data ) {
|
|
|
|
|
currentNewSectionEditLinkItem.replaceWith(
|
|
|
|
|
ve.extendObject( true, {},
|
|
|
|
|
currentNewSectionEditLinkItem.getElement(),
|
2014-08-22 20:50:48 +00:00
|
|
|
|
{ type: newNewSectionEditLinkOptionData.data }
|
2013-11-15 20:50:15 +00:00
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-04-04 17:42:13 +00:00
|
|
|
|
|
2014-04-22 21:07:13 +00:00
|
|
|
|
if ( this.displayTitleTouched ) {
|
|
|
|
|
if ( currentDisplayTitleItem ) {
|
|
|
|
|
if ( newDisplayTitle ) {
|
|
|
|
|
if ( currentDisplayTitleItem.getAttribute( 'content' ) !== newDisplayTitle ) {
|
|
|
|
|
// There was a display title and is a new one, but they differ, so replace
|
|
|
|
|
currentDisplayTitleItem.replaceWith(
|
|
|
|
|
ve.extendObject( true, {},
|
|
|
|
|
currentDisplayTitleItem.getElement(),
|
|
|
|
|
newDisplayTitleItemData
|
|
|
|
|
) );
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// There was a display title and is no new one, so remove
|
|
|
|
|
currentDisplayTitleItem.remove();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if ( newDisplayTitle ) {
|
|
|
|
|
// There's no existing display title but there is a new one, so create
|
|
|
|
|
// HACK: Putting this at index 0, offset 0 so that it works – bug 61862
|
|
|
|
|
this.metaList.insertMeta( newDisplayTitleItemData, 0, 0 );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-15 14:09:48 +00:00
|
|
|
|
$.each( this.metaItemCheckboxes, function () {
|
|
|
|
|
var currentItem = advancedSettingsPage.getMetaItem( this.metaName ),
|
2014-12-09 21:01:13 +00:00
|
|
|
|
isSelected = this.fieldLayout.getField().isSelected();
|
2014-04-15 14:09:48 +00:00
|
|
|
|
|
2014-12-09 21:01:13 +00:00
|
|
|
|
if ( currentItem && !isSelected ) {
|
2014-04-15 14:09:48 +00:00
|
|
|
|
currentItem.remove();
|
2014-12-09 21:01:13 +00:00
|
|
|
|
} else if ( !currentItem && isSelected ) {
|
2014-08-22 20:50:48 +00:00
|
|
|
|
advancedSettingsPage.metaList.insertMeta( { type: this.metaName } );
|
2014-04-15 14:09:48 +00:00
|
|
|
|
}
|
|
|
|
|
} );
|
|
|
|
|
|
2014-04-04 17:42:13 +00:00
|
|
|
|
this.metaList = null;
|
2013-11-15 20:36:53 +00:00
|
|
|
|
};
|