From 93d9d7db076ae9b47b90bd34b9690b94224ffaaa Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sat, 5 Jan 2013 12:56:44 -0500 Subject: [PATCH] updated link editing ajax callback --- app/assets/javascripts/Jit/graphsettings.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/Jit/graphsettings.js b/app/assets/javascripts/Jit/graphsettings.js index 779b1391..5e19339e 100644 --- a/app/assets/javascripts/Jit/graphsettings.js +++ b/app/assets/javascripts/Jit/graphsettings.js @@ -582,9 +582,9 @@ function onCreateLabelHandler(domElement, node) { //link is rendered differently if user is logged out or in var go_link, a_tag, close_a_tag; if (userid == null) { - golink = ''; - var a_tag = ''; - var close_a_tag = ''; + go_link = ''; + a_tag = ''; + close_a_tag = ''; } else { go_link = '[go]'; @@ -615,6 +615,7 @@ function onCreateLabelHandler(domElement, node) { metacode_choices += "]'"; var desc_nil = "Click to add description."; + var link_nil = "Click to add link."; html = html.replace(/\$_id_\$/g, node.id); html = html.replace(/\$_metacode_\$/g, node.getData("metacode")); @@ -623,10 +624,14 @@ function onCreateLabelHandler(domElement, node) { html = html.replace(/\$_userid_\$/g, node.getData("userid")); html = html.replace(/\$_username_\$/g, node.getData("username")); html = html.replace(/\$_metacode_choices_\$/g, metacode_choices); - html = html.replace(/\$_link_\$/g, node.getData("link")); html = html.replace(/\$_go_link_\$/g, go_link); html = html.replace(/\$_a_tag_\$/g, a_tag); html = html.replace(/\$_close_a_tag_\$/g, close_a_tag); + if (node.getData("link") == "") { + html = html.replace(/\$_link_\$/g, link_nil); + } else { + html = html.replace(/\$_link_\$/g, node.getData("link")); + } html = html.replace(/\$_desc_nil_\$/g, desc_nil); if (node.getData("desc") == "" && userid != null) { @@ -757,6 +762,7 @@ function onCreateLabelHandler(domElement, node) { var link = $(this).html(); $(topcard + ' .focusright a').html(link); $(topcard + ' .focusright a').attr('href', link); + $(showCard).find('.go-link').attr('href', link); }); }//onCreateLabelHandler