Merge "Add required indicators to parameter pages"

This commit is contained in:
jenkins-bot 2014-03-08 00:49:50 +00:00 committed by Gerrit Code Review
commit ee586bde61
2 changed files with 22 additions and 4 deletions

View file

@ -29,6 +29,7 @@ ve.ui.MWParameterPage = function VeUiMWParameterPage( parameter, name, config )
this.$label = this.$( '<div>' ); this.$label = this.$( '<div>' );
this.$field = this.$( '<div>' ); this.$field = this.$( '<div>' );
this.$actions = this.$( '<div>' ); this.$actions = this.$( '<div>' );
this.$indicators = this.$( '<div>' );
this.$info = this.$( '<div>' ); this.$info = this.$( '<div>' );
this.$description = this.$( '<div>' ); this.$description = this.$( '<div>' );
this.$more = this.$( '<div>' ); this.$more = this.$( '<div>' );
@ -56,6 +57,7 @@ ve.ui.MWParameterPage = function VeUiMWParameterPage( parameter, name, config )
'tabIndex': -1 'tabIndex': -1
} ) } )
.connect( this, { 'click': 'onAddButtonClick' } ); .connect( this, { 'click': 'onAddButtonClick' } );
this.requiredIndicator = new OO.ui.IndicatorWidget( { '$': this.$ } );
// TODO: Use spec.deprecation // TODO: Use spec.deprecation
// TODO: Use spec.type // TODO: Use spec.type
@ -71,6 +73,9 @@ ve.ui.MWParameterPage = function VeUiMWParameterPage( parameter, name, config )
this.$actions this.$actions
.addClass( 've-ui-mwParameterPage-actions' ) .addClass( 've-ui-mwParameterPage-actions' )
.append( this.removeButton.$element ); .append( this.removeButton.$element );
this.$indicators
.addClass( 've-ui-mwParameterPage-indicators' )
.append( this.requiredIndicator.$element );
this.$description this.$description
.addClass( 've-ui-mwParameterPage-description' ) .addClass( 've-ui-mwParameterPage-description' )
.text( this.spec.getParameterDescription( paramName ) || '' ); .text( this.spec.getParameterDescription( paramName ) || '' );
@ -79,13 +84,21 @@ ve.ui.MWParameterPage = function VeUiMWParameterPage( parameter, name, config )
.append( this.$description ); .append( this.$description );
this.$field this.$field
.addClass( 've-ui-mwParameterPage-field' ) .addClass( 've-ui-mwParameterPage-field' )
.append( this.valueInput.$element, this.$actions, this.$info ); .append( this.valueInput.$element, this.$indicators, this.$actions, this.$info );
this.$more this.$more
.addClass( 've-ui-mwParameterPage-more' ) .addClass( 've-ui-mwParameterPage-more' )
.append( this.addButton.$element ); .append( this.addButton.$element );
this.$element this.$element
.addClass( 've-ui-mwParameterPage' ) .addClass( 've-ui-mwParameterPage' )
.append( this.$label, this.$field, this.$more ); .append( this.$label, this.$field, this.$more );
if ( this.parameter.isRequired() ) {
this.requiredIndicator
.setIndicator( 'required' )
.setIndicatorTitle(
ve.msg( 'visualeditor-dialog-transclusion-required-parameter' )
);
}
}; };
/* Inheritance */ /* Inheritance */

View file

@ -24,6 +24,7 @@
.ve-ui-mwParameterPage-field, .ve-ui-mwParameterPage-field,
.ve-ui-mwParameterPage-info, .ve-ui-mwParameterPage-info,
.ve-ui-mwParameterPage-actions, .ve-ui-mwParameterPage-actions,
.ve-ui-mwParameterPage-indicators,
.ve-ui-mwParameterPage .oo-ui-textInputWidget { .ve-ui-mwParameterPage .oo-ui-textInputWidget {
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
@ -46,20 +47,24 @@
} }
.ve-ui-mwParameterPage .oo-ui-textInputWidget { .ve-ui-mwParameterPage .oo-ui-textInputWidget {
width: 90%; width: 86%;
} }
.ve-ui-mwParameterPage .oo-ui-textInputWidget textarea { .ve-ui-mwParameterPage .oo-ui-textInputWidget textarea {
height: 2.5em; height: 2.5em;
} }
.ve-ui-mwParameterPage-indicators,
.ve-ui-mwParameterPage-actions { .ve-ui-mwParameterPage-actions {
display: none; width: 7%;
width: 10%;
padding: 0.33em 0; padding: 0.33em 0;
text-align: right; text-align: right;
} }
.ve-ui-mwParameterPage-actions {
display: none;
}
.ve-ui-mwParameterPage.oo-ui-pageLayout-active .ve-ui-mwParameterPage-actions { .ve-ui-mwParameterPage.oo-ui-pageLayout-active .ve-ui-mwParameterPage-actions {
display: inline-block; display: inline-block;
} }