mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 06:46:26 +00:00
Merge "Move autoValue logic from ui.MWParameterPage to dm.MWParameterModel"
This commit is contained in:
commit
20b20bc97c
|
@ -110,10 +110,29 @@ ve.dm.MWParameterModel.prototype.getOriginalName = function () {
|
|||
/**
|
||||
* Get parameter value.
|
||||
*
|
||||
* @returns {string} Parameter value
|
||||
* @returns {string} Parameter value, or automatic value if there is none stored.
|
||||
* Otherwise an empty string.
|
||||
*/
|
||||
ve.dm.MWParameterModel.prototype.getValue = function () {
|
||||
return this.value;
|
||||
return this.value || this.getAutoValue() || '';
|
||||
};
|
||||
|
||||
/**
|
||||
* Get default parameter value.
|
||||
*
|
||||
* @returns {string} Default parameter value
|
||||
*/
|
||||
ve.dm.MWParameterModel.prototype.getDefaultValue = function () {
|
||||
return this.template.getSpec().getParameterDefaultValue( this.name );
|
||||
};
|
||||
|
||||
/**
|
||||
* Get automatic parameter value.
|
||||
*
|
||||
* @returns {string} Automatic parameter name.
|
||||
*/
|
||||
ve.dm.MWParameterModel.prototype.getAutoValue = function () {
|
||||
return this.template.getSpec().getParameterAutoValue( this.name );
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,11 +30,7 @@ ve.ui.MWParameterPage = function VeUiMWParameterPage( parameter, name, config )
|
|||
// Properties
|
||||
this.parameter = parameter;
|
||||
this.spec = parameter.getTemplate().getSpec();
|
||||
this.defaultValue = this.spec.getParameterDefaultValue( paramName );
|
||||
this.autoValue = this.spec.getParameterAutoValue( paramName );
|
||||
if ( this.autoValue && !this.parameter.getValue() ) {
|
||||
this.parameter.setValue( this.autoValue );
|
||||
}
|
||||
this.defaultValue = parameter.getDefaultValue();
|
||||
|
||||
this.$info = this.$( '<div>' );
|
||||
this.$actions = this.$( '<div>' );
|
||||
|
|
Loading…
Reference in a new issue