Skip to content

Commit

Permalink
Return the recipe to available list if the wizards it's closed and da…
Browse files Browse the repository at this point in the history
…ta isn't save
  • Loading branch information
David Amian authored and root committed Feb 21, 2012
1 parent 6b0e988 commit bbafe5b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
12 changes: 12 additions & 0 deletions app/assets/javascripts/advanced_data.js.coffee
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ $(document).ready ->
$(select).removeAttr("disabled") $(select).removeAttr("disabled")
false 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) { var on_field_change = function(event) {


Expand Down
11 changes: 7 additions & 4 deletions app/assets/javascripts/nodes.js.coffee
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ $(document).ready ->


jQuery(document).bind 'close.facebox', (event) -> jQuery(document).bind 'close.facebox', (event) ->
assistantIsRunning = false assistantIsRunning = false



$("#run-list ul").sortable $("#run-list ul").sortable
connectWith: ["#recipes ul", "#roles ul"], connectWith: ["#recipes ul", "#roles ul"],
Expand All @@ -26,15 +27,17 @@ $(document).ready ->
assistantIsRunning = false assistantIsRunning = false
else else
url = window.location.pathname 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 = ui.item.find("a[rel*=facebox]")
link.facebox() link.facebox()
link.click() link.click()
$("a.close, img.close_image").bind 'click', -> $("a.close, img.close_image").bind 'click', ->
jQuery(document).trigger('close.facebox') jQuery(document).trigger('close.facebox')
ui.sender.sortable('cancel') if $('div.edit_recipe', $('a.close').parent('div.popup')).get(0) == undefined
link.remove() ui.sender.sortable('cancel')
$(this).unbind("click") link.remove()
$(this).unbind("click")
$("#facebox").remove(".popup") $("#facebox").remove(".popup")
false false
$('#facebox_overlay').unbind("click") $('#facebox_overlay').unbind("click")
Expand Down
9 changes: 7 additions & 2 deletions app/views/nodes/advanced_data.html.haml
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,10 @@
= javascript_include_tag :users, :advanced_data = 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| - @skel.each do |attribute|
= raw render_base_attribute(attribute, "[node][normal]",@node) = raw render_base_attribute(attribute, "[node][normal]",@node)


Expand All @@ -8,7 +13,7 @@
= raw render_fieldset(attribute, @data[attribute[0]], "[node][normal]", @defaults, @use_default_data, @node) = 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 #default.float_right
= check_box "node[normal][default]", params[:recipe], :checked => ("checked" if !@use_default_data.blank?), :class => @input_class = check_box "node[normal][default]", params[:recipe], :checked => ("checked" if !@use_default_data.blank?), :class => @input_class
Expand Down

0 comments on commit bbafe5b

Please sign in to comment.