Merge "Move autoValue logic from ui.MWParameterPage to dm.MWParameterModel"

This commit is contained in:
jenkins-bot 2014-10-27 18:15:08 +00:00 committed by Gerrit Code Review
commit 20b20bc97c
2 changed files with 22 additions and 7 deletions

View file

@ -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 );
};
/**

View file

@ -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>' );