diff --git a/extensions/wikidata/module/MOD-INF/controller.js b/extensions/wikidata/module/MOD-INF/controller.js index 7daace7ed..a7a760312 100644 --- a/extensions/wikidata/module/MOD-INF/controller.js +++ b/extensions/wikidata/module/MOD-INF/controller.js @@ -58,6 +58,7 @@ function init() { "scripts/dialogs/schema-alignment-dialog.js", "scripts/dialogs/manage-account-dialog.js", "scripts/dialogs/perform-edits-dialog.js", + "scripts/jquery.uls.data.js", ]); ClientSideResourceManager.addPaths( diff --git a/extensions/wikidata/module/scripts/dialogs/schema-alignment-dialog.js b/extensions/wikidata/module/scripts/dialogs/schema-alignment-dialog.js index dbfb0215e..8e256a35a 100644 --- a/extensions/wikidata/module/scripts/dialogs/schema-alignment-dialog.js +++ b/extensions/wikidata/module/scripts/dialogs/schema-alignment-dialog.js @@ -507,7 +507,6 @@ SchemaAlignmentDialog._initPropertyField = function(inputContainer, targetContai label: data.name, datatype: datatype, }); - console.log(datatype); SchemaAlignmentDialog._addStatement(targetContainer, datatype, null); var addValueButtons = targetContainer.parent().find('.wbs-add-statement'); addValueButtons.show(); @@ -531,8 +530,12 @@ SchemaAlignmentDialog._initPropertyField = function(inputContainer, targetContai } -SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue) { +SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue, changedCallback) { var input = $('').appendTo(inputContainer); + + if (! changedCallback) { + changedCallback = SchemaAlignmentDialog._hasChanged; + } if (this._reconService !== null && mode === "wikibase-item") { input.attr("placeholder", "item or reconciled column"); @@ -541,7 +544,6 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue) var suggestConfig = $.extend({}, endpoint); suggestConfig.key = null; suggestConfig.query_param_name = "prefix"; - input.suggestP(suggestConfig).bind("fb-select", function(evt, data) { inputContainer.data("jsonValue", { @@ -549,7 +551,7 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue) qid : data.id, label: data.name, }); - SchemaAlignmentDialog._hasChanged(); + changedCallback(); }); } else if (mode === "time") { input.attr("placeholder", "YYYY(-MM(-DD))..."); @@ -563,7 +565,7 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue) propagateValue(""); input.change(function() { propagateValue($(this).val()); - SchemaAlignmentDialog._hasChanged(); + changedCallback(); }); } else if (mode === "globe-coordinate") { input.attr("placeholder", "lat/lon"); @@ -577,9 +579,56 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue) propagateValue(""); input.change(function() { propagateValue($(this).val()); - SchemaAlignmentDialog._hasChanged(); + changedCallback(); }); - } else { /* if (mode === "external-id") { */ + } else if (mode === "quantity") { + alert("not supported yet!"); + } else if (mode === "language") { + var initial_language_width = "20%"; + var expanded_width = "90px"; + var animation_duration = 50; + input.attr("placeholder", "lang"); + inputContainer.width(initial_language_width); + input.langsuggest().bind("fb-select", function(evt, data) { + inputContainer.data("jsonValue", { + type: "wblanguageconstant", + id: data.id, + label: data.name, + }); + changedCallback(); + inputContainer.animate({ width: initial_language_width, duration: animation_duration }); + }).bind("focus.suggest", function(e) { + inputContainer.animate({ width: expanded_width, duration: animation_duration }); + }); + } else if (mode === "monolingualtext") { + input.remove(); + var inputContainerLanguage = $('