From e1f454c4f4a3f73b347e67c10796a2bc8e25e6f7 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Thu, 7 Feb 2013 18:51:41 -0500 Subject: [PATCH] set up data nil. still need to make sure nodes with only whitespace in their description field are editable --- .../Jit/select-edit-delete-nodes-and-edges.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/Jit/select-edit-delete-nodes-and-edges.js b/app/assets/javascripts/Jit/select-edit-delete-nodes-and-edges.js index ecbb55e5..c85cf2a8 100644 --- a/app/assets/javascripts/Jit/select-edit-delete-nodes-and-edges.js +++ b/app/assets/javascripts/Jit/select-edit-delete-nodes-and-edges.js @@ -36,7 +36,9 @@ function populateEditEdgeForm(edge) { add_direction_form(edge); add_name_form(edge); } + function add_name_form(edge) { + var data_nil = 'Click to add description.'; //name editing form $('#edit_synapse').append('
'); $('#edit_synapse_name').attr('class', 'best_in_place best_in_place_desc'); @@ -44,17 +46,26 @@ function add_name_form(edge) { $('#edit_synapse_name').attr('data-attribute', 'desc'); $('#edit_synapse_name').attr('data-type', 'input'); //TODO how to get blank data-nil - $('#edit_synapse_name').attr('data-nil', ' '); + $('#edit_synapse_name').attr('data-nil', data_nil); $('#edit_synapse_name').attr('data-url', '/synapses/' + edge.getData("id")); $('#edit_synapse_name').html(edge.getData("desc")); + $('#edit_synapse_name').click(function() { + + }); + $('#edit_synapse_name').bind("ajax:success", function() { var desc = $(this).html(); - edge.setData("desc", desc); + if (desc == data_nil) { + edge.setData("desc", ''); + } else { + edge.setData("desc", desc); + } selectEdge(edge); Mconsole.plot(); }); } + function add_perms_form(edge) { //permissions - if owner, also allow permission editing $('#edit_synapse').append('
');