From 68122b2b276ef0bedfd77f4c9358ec096b913f31 Mon Sep 17 00:00:00 2001 From: Antonin Delpeuch Date: Thu, 7 Sep 2017 14:00:43 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20qualifier=20addition=20=C3=A0nd=20seriali?= =?UTF-8?q?zation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dialogs/schema-alignment-dialog.js | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/extensions/wikidata/module/scripts/dialogs/schema-alignment-dialog.js b/extensions/wikidata/module/scripts/dialogs/schema-alignment-dialog.js index 20fd3a2a0..dd4da1785 100644 --- a/extensions/wikidata/module/scripts/dialogs/schema-alignment-dialog.js +++ b/extensions/wikidata/module/scripts/dialogs/schema-alignment-dialog.js @@ -282,7 +282,7 @@ SchemaAlignmentDialog._addStatementGroup = function(item, json) { SchemaAlignmentDialog._statementGroupToJSON = function (statementGroup) { var lst = new Array(); - statementGroup.find('.wbs-statement').each(function () { + statementGroup.find('.wbs-statement-container').first().children('.wbs-statement').each(function () { lst.push(SchemaAlignmentDialog._statementToJSON($(this))); }); var inputContainer = statementGroup.find(".wbs-prop-input").first(); @@ -339,8 +339,10 @@ SchemaAlignmentDialog._statementToJSON = function (statement) { SchemaAlignmentDialog._addQualifier = function(container, json) { var property = null; + var value = null; if (json) { - property = json.property; + property = json.prop; + value = json.value; } var qualifier = $('
').addClass('wbs-qualifier').appendTo(container); @@ -349,6 +351,10 @@ SchemaAlignmentDialog._addQualifier = function(container, json) { var right = $('
').addClass('wbs-right').appendTo(qualifier); var statementContainer = $('
').addClass('wbs-statement-container').appendTo(right); SchemaAlignmentDialog._initPropertyField(inputContainer, statementContainer, property); + console.log(json); + if (value && property) { + SchemaAlignmentDialog._addStatement(statementContainer, property.datatype, {value:value}); + } } SchemaAlignmentDialog._removeQualifier = function(qualifier) { @@ -528,17 +534,6 @@ SchemaAlignmentDialog._removeStatement = function(statement) { } SchemaAlignmentDialog._hasChanged(); } -/* -SchemaAlignmentDialog._addStatement = function() { - var newStatement = $('
').addClass('schema-alignment-statement'); - var subject = $('
').addClass('schema-alignment-subject').appendTo(newStatement); - var prop = $('
').addClass('schema-alignment-prop').appendTo(newStatement); - var target = $('
').addClass('schema-alignment-target').appendTo(newStatement); - var qualifiersArea = $('
').addClass('schema-alignment-qualifiers').appendTo(newStatement); - var addQualifier = $('

').addClass('schema-alignment-add-qualifier').text('Add qualifier').appendTo(newStatement); - $('#schema-alignment-statements-container').append(newStatement); -} -*/ SchemaAlignmentDialog.getJSON = function() { var list = new Array();