54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'app/helpers/pyr_rules/events_helper.rb', line 54
def _render_and_recurse(key,children,stack)
return "" if key.blank? body = ""
if key == :actions children.each do |action|
body += _render_action_leaf(action, stack)
end
elsif key == :context
body = content_tag :div, class: "collapse-group", style:"block:inline;margin-left:30px;padding:5px;" do
content_tag :div, id:"#{stack.join('_')}_context", class: "collapse", style: "block:inline;padding:5px;min-height:30px;" do
context = children.collect{|k,v| "<b>#{k}</b> (<i>#{v}</i>)"}.join("<br/>")
inner_body = "<a class='btn btn-mini' data-toggle='collapse' data-target='##{stack.join('_')}_context'>context</a>".html_safe
inner_body += "<div class='collapse-group'>#{context}</div>".html_safe
inner_body += "<div style='clear:both;'></div>".html_safe
end
end
else
stack.push key
body += content_tag :div, class: "collapse-group", style: "margin-left:30px;position:relative;" do
content_tag :div, id:"#{stack.join('_')}", class: "collapse", style: "padding:5px;min-height:30px;" do
inner_body = "<a class='btn btn-mini' data-toggle='collapse' data-target='##{stack.join('_')}'>+</a><span style='font-weight:bold;'>#{key.to_s.titleize}</span>"
children.each do |child_key, grandkids|
inner_body += _render_and_recurse(child_key, grandkids, stack) + "\n"
end
inner_body.html_safe
end
end
stack.pop
end
body.html_safe
end
|