Merge "Reduce duplication/clutter in MWParameterResultWidget"

This commit is contained in:
jenkins-bot 2020-09-01 21:26:09 +00:00 committed by Gerrit Code Review
commit bf4aba90bc
2 changed files with 8 additions and 5 deletions

View file

@ -43,13 +43,13 @@
padding: 0.1em 0.25em;
margin-left: 0.5em;
color: #54595d;
background-color: #eaecf0;
background-color: #fff;
border: 1px solid #c8ccd1;
border-radius: 2px;
}
.ve-ui-mwParameterResultWidget-name:first-child {
background-color: #fff;
.ve-ui-mwParameterResultWidget-name.ve-ui-mwParameterResultWidget-alias {
background-color: #eaecf0;
}
.ve-ui-mwParameterResultWidget-description {

View file

@ -48,7 +48,7 @@ ve.ui.MWParameterResultWidget.prototype.buildLabel = function () {
.addClass( 've-ui-mwParameterResultWidget-description' )
.text( this.data.description || '' );
if ( this.data.name ) {
if ( this.data.name && this.data.name !== this.data.label ) {
$names.append(
$( '<span>' )
.addClass( 've-ui-mwParameterResultWidget-name' )
@ -56,9 +56,12 @@ ve.ui.MWParameterResultWidget.prototype.buildLabel = function () {
);
}
for ( i = 0, len = this.data.aliases.length; i < len; i++ ) {
if ( this.data.aliases[ i ] === this.data.label ) {
continue;
}
$names.append(
$( '<span>' )
.addClass( 've-ui-mwParameterResultWidget-name' )
.addClass( 've-ui-mwParameterResultWidget-name ve-ui-mwParameterResultWidget-alias' )
.text( this.data.aliases[ i ] )
);
}