Skip to content

Commit

Permalink
Merge "Mark mul descriptions as N/A in legacy Termbox via js"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Jun 28, 2023
2 parents 1acec0d + eaf845b commit 44816fe
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions view/resources.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@
'wikibase-description-edit-placeholder',
'wikibase-description-edit-placeholder-language-aware',
'wikibase-description-empty',
'wikibase-description-not-applicable',
'wikibase-description-not-applicable-title',
'wikibase-statementgrouplistview-add',
'wikibase-description-empty',
'wikibase-entitytermsview-entitytermsforlanguagelistview-configure-link-label',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@
this.element[ descriptionText ? 'removeClass' : 'addClass' ]( 'wb-empty' );

if ( !this.isInEditMode() && !descriptionText ) {
this.$text.text( mw.msg( 'wikibase-description-empty' ) );
if ( languageCode === 'mul' ) {
this.$text.empty().append(
this._createDescriptionNotApplicableElements()
);
} else {
this.$text.text( mw.msg( 'wikibase-description-empty' ) );
}
// Apply lang and dir of UI language
// instead language of that row
var userLanguage = mw.config.get( 'wgUserLanguage' );
Expand Down Expand Up @@ -189,6 +195,15 @@
return response;
},

_createDescriptionNotApplicableElements: function () {
var $abbr = $( '<abbr>' ).attr( 'title', mw.msg( 'wikibase-description-not-applicable-title' ) );
var $abbrText = $( '<span>' )
.text( mw.msg( 'wikibase-description-not-applicable' ) )
.attr( 'aria-hidden', 'true' );
$abbr.append( $abbrText );
return $abbr;
},

/**
* Gets/Sets the widget's value.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,17 @@
);
} );

QUnit.test( 'shows N/A placeholder for mul', function ( assert ) {
var $descriptionview = createDescriptionview( {
value: new datamodel.Term( 'mul', '' )
} ),
descriptionview = $descriptionview.data( 'descriptionview' );

assert.strictEqual(
descriptionview.$text.text(),
'(wikibase-description-not-applicable)',
'Shows "not applicable" placeholder.'
);
} );

}() );

0 comments on commit 44816fe

Please sign in to comment.