Update UI to allow for non-overriding terms. Closes #2063

This commit is contained in:
Antonin Delpeuch 2019-06-13 09:21:30 +01:00
parent 05839b1bbf
commit f7a8085bab
6 changed files with 32 additions and 10 deletions

View File

@ -31,8 +31,10 @@
"wikidata-schema/property-placeholder": "property",
"wikidata-schema/nb-references": " references",
"wikidata-schema/remove-column": "remove column",
"wikidata-schema/label": "Label",
"wikidata-schema/description": "Description",
"wikidata-schema/label-if-new": "New label",
"wikidata-schema/label-override": "Override label",
"wikidata-schema/description-if-new": "New description",
"wikidata-schema/description-override": "Override description",
"wikidata-schema/alias": "Alias",
"wikidata-schema/item-or-reconciled-column": "type item or drag reconciled column here",
"wikidata-schema/amount": "amount",

View File

@ -28,8 +28,10 @@
"wikidata-schema/property-placeholder": "propriété",
"wikidata-schema/nb-references": " références",
"wikidata-schema/remove-column": "supprimer la colonne",
"wikidata-schema/label": "Libellé",
"wikidata-schema/description": "Description",
"wikidata-schema/label-if-new": "Nouveau libellé",
"wikidata-schema/label-override": "Écraser le libellé",
"wikidata-schema/description-if-new": "Nouvelle description",
"wikidata-schema/description-override": "Écraser la description",
"wikidata-schema/alias": "Alias",
"wikidata-schema/item-or-reconciled-column": "entrer un élément ou déposer une colonne réconciliée ici",
"wikidata-schema/amount": "quantité",

View File

@ -441,11 +441,19 @@ SchemaAlignmentDialog._addNameDesc = function(item, json) {
var type_input = $('<select></select>').appendTo(type_container);
$('<option></option>')
.attr('value', 'LABEL')
.text($.i18n('wikidata-schema/label'))
.text($.i18n('wikidata-schema/label-override'))
.appendTo(type_input);
$('<option></option>')
.attr('value', 'LABEL_IF_NEW')
.text($.i18n('wikidata-schema/label-if-new'))
.appendTo(type_input);
$('<option></option>')
.attr('value', 'DESCRIPTION')
.text($.i18n('wikidata-schema/description'))
.text($.i18n('wikidata-schema/description-override'))
.appendTo(type_input);
$('<option></option>')
.attr('value', 'DESCRIPTION_IF_NEW')
.text($.i18n('wikidata-schema/description-if-new'))
.appendTo(type_input);
$('<option></option>')
.attr('value', 'ALIAS')

View File

@ -37,13 +37,17 @@ EditRenderer._renderItem = function(json, container) {
// Terms
if ((json.labels && json.labels.length) ||
(json.labelsIfNew && json.labelsIfNew.length) ||
(json.descriptions && json.descriptions.length) ||
(json.descriptionsIfNew && json.descriptionsIfNew.length) ||
(json.addedAliases && json.addedAliases.length)) {
var termsContainer = $('<div></div>').addClass('wbs-namedesc-container')
.appendTo(right);
this._renderTermsList(json.labels, "label", termsContainer);
this._renderTermsList(json.descriptions, "description", termsContainer);
this._renderTermsList(json.labels, "label-override", termsContainer);
this._renderTermsList(json.labelsIfNew, "label-if-new", termsContainer);
this._renderTermsList(json.descriptions, "description-override", termsContainer);
this._renderTermsList(json.descriptionsIfNew, "description-if-new", termsContainer);
this._renderTermsList(json.addedAliases, "alias", termsContainer);
// Clear the float

View File

@ -242,8 +242,13 @@ public class ItemUpdate {
*/
@JsonIgnore
public boolean isEmpty() {
return (addedStatements.isEmpty() && deletedStatements.isEmpty() && labels.isEmpty() && descriptions.isEmpty()
&& aliases.isEmpty());
return (addedStatements.isEmpty() &&
deletedStatements.isEmpty() &&
labels.isEmpty() &&
descriptions.isEmpty() &&
aliases.isEmpty() &&
labelsIfNew.isEmpty() &&
descriptionsIfNew.isEmpty());
}
/**

View File

@ -209,6 +209,7 @@ public class ItemUpdateTest {
ItemUpdate merged = update1.merge(update2);
assertEquals(Collections.singleton(description1), merged.getDescriptionsIfNew());
assertEquals(Collections.emptySet(), merged.getDescriptions());
assertFalse(merged.isEmpty());
}
@Test