From e49f1de3b8f68caf8944cda3d4b54c67da2006e0 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Sun, 7 Dec 2014 00:27:30 +0200 Subject: node_info cleanup show correct fields per node type don't accumulate callbacks (was unusable) update dialog on save with type change - no need to click node again --- src/rz_core.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/rz_core.js') diff --git a/src/rz_core.js b/src/rz_core.js index d8c549a6..ad6755b3 100644 --- a/src/rz_core.js +++ b/src/rz_core.js @@ -708,14 +708,19 @@ function tick(e) { function showNodeInfo(d, i) { view.node_info.show(d); - view.node_info.on_submit(function() { - if (d.type === "deliverable") { - graph.editDates(d.id, null, new Date($("#editstartdate").val()), new Date($("#editenddate").val())); + 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); } - graph.editName(d.id, $('.info').find('#editformname').val()); - graph.editType(d.id, d.type,$('#edittype').val()); - graph.editURL(d.id, d.type, $('#editurl').val()); - graph.editStatus(d.id, d.type, $('#editstatus').val()); update_view__graph(true); return false; }); -- cgit v1.3.1