From 1d8a9e340f4cadd94cd4cbf42c99becf61ea9078 Mon Sep 17 00:00:00 2001 From: LV-426 Date: Tue, 16 Dec 2014 15:55:37 +0200 Subject: showNodeInfo(): on_save() hook: - use graph.update_node(), - pass update_view__graph() callback --- src/rz_core.js | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/rz_core.js b/src/rz_core.js index 06a6a619..7ec19692 100644 --- a/src/rz_core.js +++ b/src/rz_core.js @@ -519,7 +519,6 @@ function update_view__graph(no_relayout) { svgInput.enable(this, d); selection.update([d]); showNodeInfo(this.parentNode.node, i); - update_view__graph(true); } d3.event.stopPropagation(); }); @@ -559,7 +558,6 @@ function update_view__graph(no_relayout) { if(d.state !== "temp") { showNodeInfo(d, i); } - update_view__graph(true); }); circle.append("svg:image") .attr("class", "status graph") @@ -703,23 +701,23 @@ function tick(e) { } function showNodeInfo(d, i) { - view.node_info.show(d); - view.node_info.on_submit(function(e, form) { - var old_type = d.type, - new_type = form.type; - if (d.type === "third-internship-proposal") { - graph.editDates(d.id, null, new Date(form.startdate), new Date(form.enddate)); - } - graph.editName(d.id, form.name); - graph.editType(d.id, d.type, form.type); - graph.editURL(d.id, d.type, form.url); - graph.editStatus(d.id, d.type, form.status); - if (new_type != old_type) { - view.node_info.show(d); - } - update_view__graph(true); - return false; + view.node_info.on_save(function(e, form_data) { + + graph.update_node(d, form_data, function(){ + var old_type = d.type, + new_type = form_data.type; + + if (new_type != old_type) { + view.node_info.show(d); + } + + view.node_info.hide(); + update_view__graph(true); + }); + + return false; }); + view.node_info.on_delete(function() { if (confirm('This node and all its connections will be deleted, are you sure?')) { graph.removeNode(d.id); @@ -727,6 +725,8 @@ function showNodeInfo(d, i) { view.node_info.hide(); } }); + + view.node_info.show(d); } function svg_click_handler(e) { -- cgit v1.3.1