From f792e0ddc1976ce7f3e430618f86891c8cf9b3ae Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Tue, 11 Nov 2014 15:17:46 +0200 Subject: rz_core: split off view/node_info --- scripts/rz_core.js | 50 +++++++------------------------------------------- 1 file changed, 7 insertions(+), 43 deletions(-) (limited to 'scripts/rz_core.js') diff --git a/scripts/rz_core.js b/scripts/rz_core.js index 60a16029..97dfafa9 100644 --- a/scripts/rz_core.js +++ b/scripts/rz_core.js @@ -1,7 +1,7 @@ "use strict" -define(['jquery', 'd3', 'consts', 'signal', 'util', 'model/graph', 'view/helpers'], -function($, d3, consts, signal, util, model_graph, view_helpers) { +define(['jquery', 'd3', 'consts', 'signal', 'util', 'model/graph', 'view/helpers', 'view/node_info'], +function($, d3, consts, signal, util, model_graph, view_helpers, view_node_info) { var addednodes = []; @@ -519,43 +519,8 @@ function highlight(n) function showInfo(d, i) { if (d.state !== "chosen" && d.state !== 'temp') { highlight(d); - $('.info').fadeIn(300); - - if (d.type === "deliverable") { - $('.info').html('Name: ' + d.id + '




'); - } else if(d.type=== "chainlink"){ - $('.info').html('Name: ' + d.id + '
'); - }else{ - $('.info').html('Name: ' + d.id + '


'); - } - - - $('.info').css("border-color", view_helpers.customColor(d.type)); - - $("#editenddate").datepicker({ - inline: true, - showOtherMonths: true, - dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], - }); - - $("#editstartdate").datepicker({ - inline: true, - showOtherMonths: true, - dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], - }); - - $('#editdescription').val(d.type); - - $('#edittype').val(d.type); - - $('#editurl').val(d.url); - - if (d.type === "deliverable") { - $('#editstartdate').val(d.start); - $('#editenddate').val(d.end); - } - - $("#editbox").submit(function() { + 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())); } @@ -564,17 +529,16 @@ function showInfo(d, i) { graph.update(true); return false; }); - - $("#deletenode").click(function() { + view_node_info.on_delete(function() { if (confirm('This node and all its connections will be deleted, are you sure?')) { graph.removeNode(d.id, null); graph.update(false); - $('.info').hide(); + view_node_info.hide(); } }); } else { removeHighlight(); - $('.info').fadeOut(300); + view_node_info.hide(); } graph.update(true); } -- cgit v1.3.1