Change override term UI to use checkbox
This commit is contained in:
parent
f7a8085bab
commit
30c0108241
@ -31,10 +31,13 @@
|
|||||||
"wikidata-schema/property-placeholder": "property",
|
"wikidata-schema/property-placeholder": "property",
|
||||||
"wikidata-schema/nb-references": " references",
|
"wikidata-schema/nb-references": " references",
|
||||||
"wikidata-schema/remove-column": "remove column",
|
"wikidata-schema/remove-column": "remove column",
|
||||||
"wikidata-schema/label-if-new": "New label",
|
"wikidata-schema/label": "Label",
|
||||||
"wikidata-schema/label-override": "Override label",
|
"wikidata-schema/label-if-new": "Label (do not override)",
|
||||||
"wikidata-schema/description-if-new": "New description",
|
"wikidata-schema/label-override": "Label (override if present)",
|
||||||
"wikidata-schema/description-override": "Override description",
|
"wikidata-schema/description": "Description",
|
||||||
|
"wikidata-schema/description-if-new": "Description (do not override)",
|
||||||
|
"wikidata-schema/description-override": "Description (override if present)",
|
||||||
|
"wikidata-schema/override-term": "override if present",
|
||||||
"wikidata-schema/alias": "Alias",
|
"wikidata-schema/alias": "Alias",
|
||||||
"wikidata-schema/item-or-reconciled-column": "type item or drag reconciled column here",
|
"wikidata-schema/item-or-reconciled-column": "type item or drag reconciled column here",
|
||||||
"wikidata-schema/amount": "amount",
|
"wikidata-schema/amount": "amount",
|
||||||
|
@ -28,10 +28,13 @@
|
|||||||
"wikidata-schema/property-placeholder": "propriété",
|
"wikidata-schema/property-placeholder": "propriété",
|
||||||
"wikidata-schema/nb-references": " références",
|
"wikidata-schema/nb-references": " références",
|
||||||
"wikidata-schema/remove-column": "supprimer la colonne",
|
"wikidata-schema/remove-column": "supprimer la colonne",
|
||||||
"wikidata-schema/label-if-new": "Nouveau libellé",
|
"wikidata-schema/label-if-new": "Libellé",
|
||||||
"wikidata-schema/label-override": "Écraser le libellé",
|
"wikidata-schema/label-if-new": "Libellé (sans écraser)",
|
||||||
"wikidata-schema/description-if-new": "Nouvelle description",
|
"wikidata-schema/label-override": "Libellé (écrase si déjà présent)",
|
||||||
"wikidata-schema/description-override": "Écraser la description",
|
"wikidata-schema/description": "Description",
|
||||||
|
"wikidata-schema/description-if-new": "Description (sans écraser)",
|
||||||
|
"wikidata-schema/description-override": "Description (écrase si déjà présent)",
|
||||||
|
"wikidata-schema/override-term": "Écrase si déjà présent",
|
||||||
"wikidata-schema/alias": "Alias",
|
"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/item-or-reconciled-column": "entrer un élément ou déposer une colonne réconciliée ici",
|
||||||
"wikidata-schema/amount": "quantité",
|
"wikidata-schema/amount": "quantité",
|
||||||
|
@ -428,11 +428,13 @@ SchemaAlignmentDialog._itemToJSON = function (item) {
|
|||||||
**************************/
|
**************************/
|
||||||
|
|
||||||
SchemaAlignmentDialog._addNameDesc = function(item, json) {
|
SchemaAlignmentDialog._addNameDesc = function(item, json) {
|
||||||
var type = 'ALIAS';
|
var term_type = 'ALIAS';
|
||||||
var value = null;
|
var value = null;
|
||||||
|
var override = false;
|
||||||
if (json) {
|
if (json) {
|
||||||
type = json.name_type;
|
term_type = json.name_type.replace('_IF_NEW', '');
|
||||||
value = json.value;
|
value = json.value;
|
||||||
|
override = json.name_type.indexOf('_IF_NEW') == -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var container = item.find('.wbs-namedesc-container').first();
|
var container = item.find('.wbs-namedesc-container').first();
|
||||||
@ -441,28 +443,17 @@ SchemaAlignmentDialog._addNameDesc = function(item, json) {
|
|||||||
var type_input = $('<select></select>').appendTo(type_container);
|
var type_input = $('<select></select>').appendTo(type_container);
|
||||||
$('<option></option>')
|
$('<option></option>')
|
||||||
.attr('value', 'LABEL')
|
.attr('value', 'LABEL')
|
||||||
.text($.i18n('wikidata-schema/label-override'))
|
.text($.i18n('wikidata-schema/label'))
|
||||||
.appendTo(type_input);
|
|
||||||
$('<option></option>')
|
|
||||||
.attr('value', 'LABEL_IF_NEW')
|
|
||||||
.text($.i18n('wikidata-schema/label-if-new'))
|
|
||||||
.appendTo(type_input);
|
.appendTo(type_input);
|
||||||
$('<option></option>')
|
$('<option></option>')
|
||||||
.attr('value', 'DESCRIPTION')
|
.attr('value', 'DESCRIPTION')
|
||||||
.text($.i18n('wikidata-schema/description-override'))
|
.text($.i18n('wikidata-schema/description'))
|
||||||
.appendTo(type_input);
|
|
||||||
$('<option></option>')
|
|
||||||
.attr('value', 'DESCRIPTION_IF_NEW')
|
|
||||||
.text($.i18n('wikidata-schema/description-if-new'))
|
|
||||||
.appendTo(type_input);
|
.appendTo(type_input);
|
||||||
$('<option></option>')
|
$('<option></option>')
|
||||||
.attr('value', 'ALIAS')
|
.attr('value', 'ALIAS')
|
||||||
.text($.i18n('wikidata-schema/alias'))
|
.text($.i18n('wikidata-schema/alias'))
|
||||||
.appendTo(type_input);
|
.appendTo(type_input);
|
||||||
type_input.val(type);
|
type_input.val(term_type);
|
||||||
type_input.on('change', function(e) {
|
|
||||||
SchemaAlignmentDialog._hasChanged();
|
|
||||||
});
|
|
||||||
|
|
||||||
var toolbar = $('<div></div>').addClass('wbs-toolbar').appendTo(namedesc);
|
var toolbar = $('<div></div>').addClass('wbs-toolbar').appendTo(namedesc);
|
||||||
SchemaAlignmentDialog._makeDeleteButton().click(function(e) {
|
SchemaAlignmentDialog._makeDeleteButton().click(function(e) {
|
||||||
@ -475,10 +466,37 @@ SchemaAlignmentDialog._addNameDesc = function(item, json) {
|
|||||||
var value_container = $('<div></div>').addClass('wbs-namedesc-value').appendTo(namedesc);
|
var value_container = $('<div></div>').addClass('wbs-namedesc-value').appendTo(namedesc);
|
||||||
SchemaAlignmentDialog._initField(value_container, "monolingualtext", value);
|
SchemaAlignmentDialog._initField(value_container, "monolingualtext", value);
|
||||||
|
|
||||||
|
var override_container = $('<div></div>').addClass('wbs-namedesc-override').appendTo(namedesc);
|
||||||
|
var label = $('<label></label>').appendTo(override_container);
|
||||||
|
var checkbox = $('<input></input>')
|
||||||
|
.attr('type', 'checkbox')
|
||||||
|
.prop('checked', override)
|
||||||
|
.appendTo(label);
|
||||||
|
var span = $('<span></span>').text($.i18n('wikidata-schema/override-term')).appendTo(label);
|
||||||
|
checkbox.on('change', function(e) {
|
||||||
|
SchemaAlignmentDialog._hasChanged();
|
||||||
|
});
|
||||||
|
type_input.on('change', function(e) {
|
||||||
|
var checkbox_visible = type_input.val() !== 'ALIAS';
|
||||||
|
if (checkbox_visible) {
|
||||||
|
override_container.show();
|
||||||
|
} else {
|
||||||
|
override_container.hide();
|
||||||
|
}
|
||||||
|
SchemaAlignmentDialog._hasChanged();
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SchemaAlignmentDialog._nameDescToJSON = function (namedesc) {
|
SchemaAlignmentDialog._nameDescToJSON = function (namedesc) {
|
||||||
var type = namedesc.find('select').first().val();
|
var term_type = namedesc.find('select').first().val();
|
||||||
|
var type = term_type;
|
||||||
|
if (term_type !== 'ALIAS') {
|
||||||
|
var override = namedesc.find('input[type=checkbox]').first().is(':checked');
|
||||||
|
if (!override) {
|
||||||
|
type = term_type + '_IF_NEW';
|
||||||
|
}
|
||||||
|
}
|
||||||
var value = namedesc.find('.wbs-namedesc-value').first().data("jsonValue");
|
var value = namedesc.find('.wbs-namedesc-value').first().data("jsonValue");
|
||||||
return {
|
return {
|
||||||
type: "wbnamedescexpr",
|
type: "wbnamedescexpr",
|
||||||
|
@ -451,6 +451,15 @@
|
|||||||
width: 300px;
|
width: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wbs-namedesc-override {
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wbs-namedesc-override input {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
.wbs-language-input {
|
.wbs-language-input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user