Skip to content
Browse files

Return the recipe to available list if the wizards it's closed and da…

…ta isn't save
  • Loading branch information...
1 parent 6b0e988 commit bbafe5b5ade67295091c78001426a074bbcd5d3c @amian84 amian84 committed with root Feb 20, 2012
View
12 app/assets/javascripts/advanced_data.js.coffee
@@ -19,6 +19,18 @@ $(document).ready ->
$(select).removeAttr("disabled")
false
+ $(":submit.submitfacebox").bind 'click', (event) ->
+ list = $("#run-list ul li").map (index, elem) ->
+ if $(elem).data('edit_recipe') == undefined
+ return elem;
+ $(list).each (index, elem) ->
+ $(elem).data('edit_recipe',1)
+ if $('a', elem).attr('href') != undefined
+ href = $('a', elem).attr('href')
+ href = href + "&edit_recipe=1"
+ $('a', elem).attr('href', href)
+
+
`
var on_field_change = function(event) {
View
11 app/assets/javascripts/nodes.js.coffee
@@ -11,6 +11,7 @@ $(document).ready ->
jQuery(document).bind 'close.facebox', (event) ->
assistantIsRunning = false
+
$("#run-list ul").sortable
connectWith: ["#recipes ul", "#roles ul"],
@@ -26,15 +27,17 @@ $(document).ready ->
assistantIsRunning = false
else
url = window.location.pathname
- ui.item.append("<span><a href="+url+"/advanced_data?recipe="+recipe+" rel=facebox>Edit</a></span>")
+ $("a.close, img.close_image").unbind("click")
+ ui.item.append("<span><a href="+url+"/advanced_data?recipe="+recipe+ " rel=facebox>Edit</a></span>")
link = ui.item.find("a[rel*=facebox]")
link.facebox()
link.click()
$("a.close, img.close_image").bind 'click', ->
jQuery(document).trigger('close.facebox')
- ui.sender.sortable('cancel')
- link.remove()
- $(this).unbind("click")
+ if $('div.edit_recipe', $('a.close').parent('div.popup')).get(0) == undefined
+ ui.sender.sortable('cancel')
+ link.remove()
+ $(this).unbind("click")
$("#facebox").remove(".popup")
false
$('#facebox_overlay').unbind("click")
View
9 app/views/nodes/advanced_data.html.haml
@@ -1,5 +1,10 @@
= javascript_include_tag :users, :advanced_data
-#attr_base
+- if params[:edit_recipe] == '1'
+ #attr_base.edit_recipe
+ - @skel.each do |attribute|
+ = raw render_base_attribute(attribute, "[node][normal]",@node)
+- else
+ #attr_base
- @skel.each do |attribute|
= raw render_base_attribute(attribute, "[node][normal]",@node)
@@ -8,7 +13,7 @@
= raw render_fieldset(attribute, @data[attribute[0]], "[node][normal]", @defaults, @use_default_data, @node)
- = submit_tag
+ = submit_tag "Save Changes", :class => 'submitfacebox'
#default.float_right
= check_box "node[normal][default]", params[:recipe], :checked => ("checked" if !@use_default_data.blank?), :class => @input_class

0 comments on commit bbafe5b

Please sign in to comment.
Something went wrong with that request. Please try again.