From 407fad54103be4788760dc60728c6b0a7ecaa3b3 Mon Sep 17 00:00:00 2001 From: gray Date: Tue, 19 Jul 2011 15:49:59 +0300 Subject: [PATCH] Add if/else brackets --- lib/generators/cocoon/install/templates/cocoon.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/generators/cocoon/install/templates/cocoon.js b/lib/generators/cocoon/install/templates/cocoon.js index a5d2225..9a9ce0f 100644 --- a/lib/generators/cocoon/install/templates/cocoon.js +++ b/lib/generators/cocoon/install/templates/cocoon.js @@ -28,20 +28,23 @@ $(document).ready(function() { new_content = new_content.replace(regexp_underscord, newcontent_underscord); - if (insertionNode) + if (insertionNode){ insertionNode = $(insertionNode); - else + } else { insertionNode = $(this).parent(); + } var contentNode = $(new_content); - if (insertionPosition == 'after') + if (insertionPosition == 'after'){ insertionNode.after(contentNode); - else + } else { insertionNode.before(contentNode); - - if (insertionCallback) + } + + if (insertionCallback){ insertionCallback.call(contentNode); + } }); $('.remove_fields.dynamic').live('click', function(e) {