2013-12-02 20:10:55 +00:00
|
|
|
/*!
|
2014-02-24 21:49:48 +00:00
|
|
|
* VisualEditor user interface MWParameterPage class.
|
2013-12-02 20:10:55 +00:00
|
|
|
*
|
2020-01-08 17:13:04 +00:00
|
|
|
* @copyright 2011-2020 VisualEditor Team and others; see AUTHORS.txt
|
2013-12-02 20:10:55 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MediaWiki transclusion dialog template page.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends OO.ui.PageLayout
|
|
|
|
*
|
|
|
|
* @constructor
|
2014-02-24 21:49:48 +00:00
|
|
|
* @param {ve.dm.MWParameterModel} parameter Template parameter
|
2013-12-02 20:10:55 +00:00
|
|
|
* @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
|
2019-02-08 19:18:22 +00:00
|
|
|
* @cfg {boolean} [readOnly] Parameter is read-only
|
2013-12-02 20:10:55 +00:00
|
|
|
*/
|
2014-02-28 00:00:10 +00:00
|
|
|
ve.ui.MWParameterPage = function VeUiMWParameterPage( parameter, name, config ) {
|
2014-10-29 21:50:14 +00:00
|
|
|
var paramName = parameter.getName();
|
2014-02-12 21:45:37 +00:00
|
|
|
|
2014-04-25 23:50:21 +00:00
|
|
|
// Configuration initialization
|
|
|
|
config = ve.extendObject( {
|
2014-08-22 20:50:48 +00:00
|
|
|
scrollable: false
|
2014-04-25 23:50:21 +00:00
|
|
|
}, config );
|
|
|
|
|
2013-12-02 20:10:55 +00:00
|
|
|
// Parent constructor
|
2016-09-07 02:16:24 +00:00
|
|
|
ve.ui.MWParameterPage.super.call( this, name, config );
|
2013-12-02 20:10:55 +00:00
|
|
|
|
|
|
|
// Properties
|
2014-10-29 21:50:14 +00:00
|
|
|
this.edited = false;
|
2013-12-02 20:10:55 +00:00
|
|
|
this.parameter = parameter;
|
2014-10-29 21:50:14 +00:00
|
|
|
this.originalValue = parameter.getValue();
|
2014-02-26 00:29:13 +00:00
|
|
|
this.spec = parameter.getTemplate().getSpec();
|
2014-10-26 15:22:09 +00:00
|
|
|
this.defaultValue = parameter.getDefaultValue();
|
2015-03-04 23:31:05 +00:00
|
|
|
this.exampleValue = parameter.getExampleValue();
|
2014-10-22 22:46:20 +00:00
|
|
|
|
2015-04-09 23:47:15 +00:00
|
|
|
this.$info = $( '<div>' );
|
|
|
|
this.$actions = $( '<div>' );
|
|
|
|
this.$labelElement = $( '<div>' );
|
|
|
|
this.$field = $( '<div>' );
|
|
|
|
this.$more = $( '<div>' );
|
|
|
|
this.$description = $( '<div>' );
|
2014-10-29 21:50:14 +00:00
|
|
|
|
2016-12-20 13:21:07 +00:00
|
|
|
// Note: Calling createValueInput() sets some properties we rely on later in this function
|
2014-10-29 21:50:14 +00:00
|
|
|
this.valueInput = this.createValueInput()
|
2014-10-22 22:46:20 +00:00
|
|
|
.setValue( this.parameter.getValue() )
|
2014-08-22 20:50:48 +00:00
|
|
|
.connect( this, { change: 'onValueInputChange' } );
|
2014-06-26 10:41:18 +00:00
|
|
|
|
2019-02-08 19:18:22 +00:00
|
|
|
if ( config.readOnly && this.valueInput.setReadOnly ) {
|
|
|
|
this.valueInput.setReadOnly( true );
|
|
|
|
}
|
|
|
|
|
2014-04-25 23:50:21 +00:00
|
|
|
this.statusIndicator = new OO.ui.IndicatorWidget( {
|
2014-08-22 20:50:48 +00:00
|
|
|
classes: [ 've-ui-mwParameterPage-statusIndicator' ]
|
2014-04-25 23:50:21 +00:00
|
|
|
} );
|
2013-12-02 20:10:55 +00:00
|
|
|
|
2016-12-20 13:21:07 +00:00
|
|
|
// Construct the description popup
|
2014-02-26 00:29:13 +00:00
|
|
|
|
2014-04-25 23:50:21 +00:00
|
|
|
this.$description
|
|
|
|
.addClass( 've-ui-mwParameterPage-description' )
|
2015-04-09 23:47:15 +00:00
|
|
|
.append( $( '<p>' ).text( this.spec.getParameterDescription( paramName ) || '' ) );
|
2014-03-06 22:00:43 +00:00
|
|
|
|
|
|
|
if ( this.parameter.isRequired() ) {
|
2014-04-25 23:50:21 +00:00
|
|
|
this.statusIndicator
|
2014-03-06 22:00:43 +00:00
|
|
|
.setIndicator( 'required' )
|
2019-01-17 06:12:38 +00:00
|
|
|
.setTitle(
|
2014-03-06 22:00:43 +00:00
|
|
|
ve.msg( 'visualeditor-dialog-transclusion-required-parameter' )
|
|
|
|
);
|
2014-04-25 23:50:21 +00:00
|
|
|
this.$description.append(
|
2015-04-09 23:47:15 +00:00
|
|
|
$( '<p>' )
|
2014-04-25 23:50:21 +00:00
|
|
|
.addClass( 've-ui-mwParameterPage-description-required' )
|
|
|
|
.text(
|
|
|
|
ve.msg( 'visualeditor-dialog-transclusion-required-parameter-description' )
|
|
|
|
)
|
|
|
|
);
|
|
|
|
} else if ( this.parameter.isDeprecated() ) {
|
|
|
|
this.statusIndicator
|
|
|
|
.setIndicator( 'alert' )
|
2019-01-17 06:12:38 +00:00
|
|
|
.setTitle(
|
2014-04-25 23:50:21 +00:00
|
|
|
ve.msg( 'visualeditor-dialog-transclusion-deprecated-parameter' )
|
|
|
|
);
|
|
|
|
this.$description.append(
|
2015-04-09 23:47:15 +00:00
|
|
|
$( '<p>' )
|
2014-04-25 23:50:21 +00:00
|
|
|
.addClass( 've-ui-mwParameterPage-description-deprecated' )
|
|
|
|
.text(
|
|
|
|
ve.msg(
|
|
|
|
'visualeditor-dialog-transclusion-deprecated-parameter-description',
|
|
|
|
this.spec.getParameterDeprecationDescription( paramName )
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
2015-03-04 23:31:05 +00:00
|
|
|
|
|
|
|
if ( this.defaultValue ) {
|
|
|
|
this.$description.append(
|
2015-04-09 23:47:15 +00:00
|
|
|
$( '<p>' )
|
2015-03-04 23:31:05 +00:00
|
|
|
.addClass( 've-ui-mwParameterPage-description-default' )
|
|
|
|
.text(
|
|
|
|
ve.msg( 'visualeditor-dialog-transclusion-param-default', this.defaultValue )
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( this.exampleValue ) {
|
|
|
|
this.$description.append(
|
2015-04-09 23:47:15 +00:00
|
|
|
$( '<p>' )
|
2015-03-04 23:31:05 +00:00
|
|
|
.addClass( 've-ui-mwParameterPage-description-example' )
|
|
|
|
.text(
|
|
|
|
ve.msg( 'visualeditor-dialog-transclusion-param-example', this.exampleValue )
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2016-12-20 13:21:07 +00:00
|
|
|
// Construct the action buttons
|
|
|
|
|
|
|
|
if ( !this.rawValueInput ) {
|
|
|
|
this.rawFallbackButton = new OO.ui.ButtonWidget( {
|
|
|
|
framed: false,
|
|
|
|
icon: 'wikiText',
|
|
|
|
title: ve.msg( 'visualeditor-dialog-transclusion-raw-fallback' )
|
|
|
|
} )
|
|
|
|
.connect( this, { click: 'onRawFallbackButtonClick' } );
|
|
|
|
|
|
|
|
this.$actions.append( this.rawFallbackButton.$element );
|
|
|
|
}
|
|
|
|
|
2014-05-30 17:17:38 +00:00
|
|
|
if ( this.$description.text().trim() === '' ) {
|
2016-12-20 13:21:07 +00:00
|
|
|
this.infoButton = new OO.ui.ButtonWidget( {
|
|
|
|
disabled: true,
|
|
|
|
title: ve.msg( 'visualeditor-dialog-transclusion-param-info-missing' ),
|
|
|
|
framed: false,
|
|
|
|
icon: 'info',
|
|
|
|
classes: [ 've-ui-mwParameterPage-infoButton' ]
|
|
|
|
} );
|
2014-04-25 23:50:21 +00:00
|
|
|
} else {
|
2016-12-20 13:21:07 +00:00
|
|
|
this.infoButton = new OO.ui.PopupButtonWidget( {
|
2018-04-04 20:37:32 +00:00
|
|
|
$overlay: config.$overlay,
|
2016-12-20 13:21:07 +00:00
|
|
|
popup: {
|
|
|
|
$content: this.$description
|
|
|
|
},
|
|
|
|
title: ve.msg( 'visualeditor-dialog-transclusion-param-info' ),
|
|
|
|
framed: false,
|
|
|
|
icon: 'info',
|
|
|
|
classes: [ 've-ui-mwParameterPage-infoButton' ]
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
this.$actions.append( this.infoButton.$element );
|
|
|
|
|
2019-02-08 19:18:22 +00:00
|
|
|
if ( !this.parameter.isRequired() && !config.readOnly ) {
|
2016-12-20 13:21:07 +00:00
|
|
|
this.removeButton = new OO.ui.ButtonWidget( {
|
|
|
|
framed: false,
|
2017-06-12 18:39:30 +00:00
|
|
|
icon: 'trash',
|
2016-12-20 13:21:07 +00:00
|
|
|
title: ve.msg( 'visualeditor-dialog-transclusion-remove-param' ),
|
|
|
|
flags: [ 'destructive' ],
|
|
|
|
classes: [ 've-ui-mwParameterPage-removeButton' ]
|
|
|
|
} )
|
|
|
|
.connect( this, { click: 'onRemoveButtonClick' } );
|
|
|
|
|
|
|
|
this.$actions.append( this.removeButton.$element );
|
2014-03-06 22:00:43 +00:00
|
|
|
}
|
2016-12-20 13:21:07 +00:00
|
|
|
|
|
|
|
this.addButton = new OO.ui.ButtonWidget( {
|
|
|
|
framed: false,
|
|
|
|
icon: 'parameter',
|
|
|
|
label: ve.msg( 'visualeditor-dialog-transclusion-add-param' ),
|
|
|
|
tabIndex: -1
|
|
|
|
} )
|
|
|
|
.connect( this, { click: 'onAddButtonFocus' } );
|
|
|
|
|
|
|
|
// Events
|
|
|
|
this.$labelElement.on( 'click', this.onLabelClick.bind( this ) );
|
|
|
|
|
|
|
|
// Initialization
|
|
|
|
this.$info
|
|
|
|
.addClass( 've-ui-mwParameterPage-info' )
|
|
|
|
.append( this.$labelElement, this.statusIndicator.$element );
|
|
|
|
this.$actions
|
|
|
|
.addClass( 've-ui-mwParameterPage-actions' );
|
|
|
|
this.$labelElement
|
|
|
|
.addClass( 've-ui-mwParameterPage-label' )
|
|
|
|
.text( this.spec.getParameterLabel( paramName ) );
|
|
|
|
this.$field
|
|
|
|
.addClass( 've-ui-mwParameterPage-field' )
|
|
|
|
.append(
|
|
|
|
this.valueInput.$element
|
|
|
|
);
|
|
|
|
this.$more
|
|
|
|
.addClass( 've-ui-mwParameterPage-more' )
|
|
|
|
.append( this.addButton.$element );
|
|
|
|
this.$element
|
|
|
|
.addClass( 've-ui-mwParameterPage' )
|
2019-02-08 19:18:22 +00:00
|
|
|
.append( this.$info, this.$field, this.$actions );
|
|
|
|
if ( !config.readOnly ) {
|
|
|
|
this.$element.append( this.$more );
|
|
|
|
}
|
2013-12-02 20:10:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
2014-02-24 21:49:48 +00:00
|
|
|
OO.inheritClass( ve.ui.MWParameterPage, OO.ui.PageLayout );
|
2013-12-02 20:10:55 +00:00
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
2014-10-29 21:50:14 +00:00
|
|
|
/**
|
|
|
|
* Get default configuration for an input widget.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @return {Object}
|
|
|
|
*/
|
|
|
|
ve.ui.MWParameterPage.prototype.getDefaultInputConfig = function () {
|
|
|
|
var required = this.parameter.isRequired(),
|
|
|
|
valueInputConfig = {
|
|
|
|
autosize: true,
|
|
|
|
required: required,
|
|
|
|
validate: required ? 'non-empty' : null
|
|
|
|
};
|
|
|
|
|
|
|
|
if ( this.defaultValue ) {
|
|
|
|
valueInputConfig.placeholder = ve.msg(
|
|
|
|
'visualeditor-dialog-transclusion-param-default',
|
|
|
|
this.defaultValue
|
|
|
|
);
|
|
|
|
} else if ( this.exampleValue ) {
|
|
|
|
valueInputConfig.placeholder = ve.msg(
|
|
|
|
'visualeditor-dialog-transclusion-param-example',
|
|
|
|
this.exampleValue
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return valueInputConfig;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a value input widget based on the parameter type and whether it is
|
|
|
|
* required or not.
|
|
|
|
*
|
|
|
|
* @return {OO.ui.InputWidget}
|
|
|
|
*/
|
|
|
|
ve.ui.MWParameterPage.prototype.createValueInput = function () {
|
|
|
|
var type = this.parameter.getType(),
|
|
|
|
value = this.parameter.getValue(),
|
|
|
|
valueInputConfig = this.getDefaultInputConfig();
|
|
|
|
|
|
|
|
this.rawValueInput = false;
|
|
|
|
delete valueInputConfig.validate;
|
|
|
|
|
|
|
|
// TODO:
|
|
|
|
// * date - T100206
|
|
|
|
// * number - T124850
|
|
|
|
// * unbalanced-wikitext/content - T106242
|
|
|
|
// * string? - T124917
|
|
|
|
if (
|
|
|
|
type === 'wiki-page-name' &&
|
|
|
|
( value === '' || mw.Title.newFromText( value ) )
|
|
|
|
) {
|
2020-08-31 15:19:36 +00:00
|
|
|
return new mw.widgets.TitleInputWidget( $.extend( {
|
|
|
|
api: ve.init.target.getContentApi()
|
|
|
|
}, valueInputConfig ) );
|
2020-08-27 16:21:23 +00:00
|
|
|
} else if (
|
|
|
|
type === 'wiki-file-name' &&
|
|
|
|
( value === '' || mw.Title.newFromText( value ) )
|
|
|
|
) {
|
|
|
|
return new mw.widgets.TitleInputWidget( $.extend( {}, valueInputConfig, {
|
|
|
|
api: ve.init.target.getContentApi(),
|
|
|
|
namespace: 6,
|
|
|
|
showImages: true
|
|
|
|
} ) );
|
2014-10-29 21:50:14 +00:00
|
|
|
} else if (
|
|
|
|
type === 'wiki-user-name' &&
|
|
|
|
( value === '' || mw.Title.newFromText( value ) )
|
|
|
|
) {
|
2020-08-18 12:16:49 +00:00
|
|
|
valueInputConfig.validate = function ( val ) {
|
2014-10-29 21:50:14 +00:00
|
|
|
// TODO: Check against wgMaxNameChars
|
2020-06-10 15:19:50 +00:00
|
|
|
// TODO: Check against unicode validation regex from MW core's User::isValidUserName
|
2020-08-18 12:16:49 +00:00
|
|
|
return !!mw.Title.newFromText( val );
|
2014-10-29 21:50:14 +00:00
|
|
|
};
|
2020-08-31 15:19:36 +00:00
|
|
|
return new mw.widgets.UserInputWidget( $.extend( {
|
|
|
|
api: ve.init.target.getContentApi()
|
|
|
|
}, valueInputConfig ) );
|
2014-10-29 21:50:14 +00:00
|
|
|
} else if (
|
|
|
|
type === 'wiki-template-name' &&
|
|
|
|
( value === '' || mw.Title.newFromText( value ) )
|
|
|
|
) {
|
2020-08-31 15:19:36 +00:00
|
|
|
return new mw.widgets.TitleInputWidget( $.extend( {
|
2018-05-04 13:30:10 +00:00
|
|
|
api: ve.init.target.getContentApi()
|
2020-08-31 15:19:36 +00:00
|
|
|
}, valueInputConfig, {
|
|
|
|
namespace: mw.config.get( 'wgNamespaceIds' ).template
|
2014-10-29 21:50:14 +00:00
|
|
|
} ) );
|
|
|
|
} else if ( type === 'boolean' && ( value === '1' || value === '0' ) ) {
|
|
|
|
return new ve.ui.MWParameterCheckboxInputWidget( valueInputConfig );
|
|
|
|
} else if (
|
|
|
|
type === 'url' &&
|
|
|
|
(
|
|
|
|
value === '' ||
|
|
|
|
ve.init.platform.getExternalLinkUrlProtocolsRegExp().exec( value.trim() )
|
|
|
|
)
|
|
|
|
) {
|
|
|
|
return ve.ui.MWExternalLinkAnnotationWidget.static.createExternalLinkInputWidget( valueInputConfig );
|
2018-09-12 17:01:03 +00:00
|
|
|
} else if ( type !== 'line' || value.indexOf( '\n' ) !== -1 ) {
|
|
|
|
// If the type is line, but there are already newlines in the provided
|
|
|
|
// value, don't break the existing content by only providing a single-
|
|
|
|
// line field. (This implies that the TemplateData for the field isn't
|
|
|
|
// complying with its use in practice...)
|
2014-10-29 21:50:14 +00:00
|
|
|
this.rawValueInput = true;
|
2018-08-07 11:39:14 +00:00
|
|
|
return new ve.ui.MWLazyMultilineTextInputWidget( valueInputConfig );
|
2014-10-29 21:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return new OO.ui.TextInputWidget( valueInputConfig );
|
|
|
|
};
|
|
|
|
|
2015-10-03 13:16:16 +00:00
|
|
|
/**
|
|
|
|
* Check if the parameter is empty
|
|
|
|
*
|
|
|
|
* @return {boolean} The parameter is empty
|
|
|
|
*/
|
2014-02-26 00:29:13 +00:00
|
|
|
ve.ui.MWParameterPage.prototype.isEmpty = function () {
|
|
|
|
return this.valueInput.getValue() === '' && this.defaultValue === '';
|
|
|
|
};
|
|
|
|
|
2015-10-03 13:16:16 +00:00
|
|
|
/**
|
|
|
|
* Handle change events from the value input
|
|
|
|
*
|
|
|
|
* @param {string} value Value
|
|
|
|
*/
|
2014-02-26 00:29:13 +00:00
|
|
|
ve.ui.MWParameterPage.prototype.onValueInputChange = function () {
|
|
|
|
var value = this.valueInput.getValue();
|
|
|
|
|
2020-11-25 13:51:30 +00:00
|
|
|
if ( !this.edited ) {
|
|
|
|
ve.track( 'activity.transclusion', { action: 'edit-parameter-value' } );
|
|
|
|
}
|
2014-10-29 21:50:14 +00:00
|
|
|
this.edited = true;
|
2014-02-26 00:29:13 +00:00
|
|
|
this.parameter.setValue( value );
|
|
|
|
|
|
|
|
if ( this.outlineItem ) {
|
2014-08-22 20:50:48 +00:00
|
|
|
this.outlineItem.setFlags( { empty: this.isEmpty() } );
|
2014-02-26 00:29:13 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-10-03 13:16:16 +00:00
|
|
|
/**
|
|
|
|
* Handle click events from the remove button
|
|
|
|
*/
|
2014-02-26 00:29:13 +00:00
|
|
|
ve.ui.MWParameterPage.prototype.onRemoveButtonClick = function () {
|
|
|
|
this.parameter.remove();
|
|
|
|
};
|
|
|
|
|
2014-10-29 21:50:14 +00:00
|
|
|
/**
|
|
|
|
* Handle click events from the raw fallback button
|
|
|
|
*/
|
|
|
|
ve.ui.MWParameterPage.prototype.onRawFallbackButtonClick = function () {
|
|
|
|
this.valueInput.$element.detach();
|
|
|
|
if ( this.rawValueInput ) {
|
|
|
|
this.valueInput = this.createValueInput()
|
|
|
|
.setValue( this.valueInput.getValue() );
|
|
|
|
} else {
|
|
|
|
this.valueInput = new OO.ui.TextInputWidget( this.getDefaultInputConfig() )
|
|
|
|
.setValue( this.edited ? this.valueInput.getValue() : this.originalValue );
|
|
|
|
this.valueInput.$input.addClass( 've-ui-mwParameter-wikitextFallbackInput' );
|
|
|
|
this.rawValueInput = true;
|
|
|
|
}
|
|
|
|
this.valueInput.connect( this, { change: 'onValueInputChange' } );
|
|
|
|
this.$field.append( this.valueInput.$element );
|
|
|
|
};
|
|
|
|
|
2015-10-03 13:16:16 +00:00
|
|
|
/**
|
|
|
|
* Handle click events from the add button
|
|
|
|
*/
|
2014-07-21 21:06:54 +00:00
|
|
|
ve.ui.MWParameterPage.prototype.onAddButtonFocus = function () {
|
2014-03-04 22:56:14 +00:00
|
|
|
var template = this.parameter.getTemplate();
|
|
|
|
template.addParameter( new ve.dm.MWParameterModel( template ) );
|
|
|
|
};
|
|
|
|
|
2015-10-03 13:16:16 +00:00
|
|
|
/**
|
|
|
|
* Handle click events from the label element
|
|
|
|
*
|
|
|
|
* @param {jQuery.Event} e Click event
|
|
|
|
*/
|
2014-02-26 00:29:13 +00:00
|
|
|
ve.ui.MWParameterPage.prototype.onLabelClick = function () {
|
|
|
|
this.valueInput.simulateLabelClick();
|
|
|
|
};
|
|
|
|
|
2014-02-15 01:37:32 +00:00
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
2016-08-22 21:44:59 +00:00
|
|
|
ve.ui.MWParameterPage.prototype.setOutlineItem = function () {
|
2014-02-15 01:37:32 +00:00
|
|
|
// Parent method
|
2016-08-22 21:44:59 +00:00
|
|
|
ve.ui.MWParameterPage.super.prototype.setOutlineItem.apply( this, arguments );
|
2014-02-15 01:37:32 +00:00
|
|
|
|
|
|
|
if ( this.outlineItem ) {
|
|
|
|
this.outlineItem
|
|
|
|
.setIcon( 'parameter' )
|
|
|
|
.setMovable( false )
|
2014-03-01 00:39:02 +00:00
|
|
|
.setRemovable( true )
|
2014-02-15 01:37:32 +00:00
|
|
|
.setLevel( 1 )
|
2014-08-22 20:50:48 +00:00
|
|
|
.setFlags( { empty: this.isEmpty() } )
|
2014-02-15 01:37:32 +00:00
|
|
|
.setLabel( this.spec.getParameterLabel( this.parameter.getName() ) );
|
|
|
|
|
|
|
|
if ( this.parameter.isRequired() ) {
|
|
|
|
this.outlineItem
|
|
|
|
.setIndicator( 'required' )
|
2019-01-17 06:12:38 +00:00
|
|
|
.setTitle(
|
2014-02-26 00:29:13 +00:00
|
|
|
ve.msg( 'visualeditor-dialog-transclusion-required-parameter' )
|
|
|
|
);
|
2014-02-15 01:37:32 +00:00
|
|
|
}
|
2014-04-25 23:50:21 +00:00
|
|
|
if ( this.parameter.isDeprecated() ) {
|
|
|
|
this.outlineItem
|
|
|
|
.setIndicator( 'alert' )
|
2019-01-17 06:12:38 +00:00
|
|
|
.setTitle(
|
2014-04-25 23:50:21 +00:00
|
|
|
ve.msg( 'visualeditor-dialog-transclusion-deprecated-parameter' )
|
|
|
|
);
|
|
|
|
}
|
2014-02-15 01:37:32 +00:00
|
|
|
}
|
|
|
|
};
|
2015-10-03 13:16:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.ui.MWParameterPage.prototype.focus = function () {
|
|
|
|
this.valueInput.focus();
|
|
|
|
};
|