%- if magic_insights.kind_of?(Array) %>
<%- magic_insight = magic_insights.last %>
<%- else %>
<%- magic_insight = magic_insights %>
<%- end %>
<%- if magic_insight.class.ancestors.include?(Rack::Insight::MagicInsight) %>
<%- magic_insight._magic_insight_methods.each do |method| %>
<%- if idiomatic_method = magic_insight._idiomatic_method(method) %>
<%= idiomatic_method %> |
<%- else %>
<%= method %> |
<%- end %>
<%- end %>
|
<%- if magic_insights.respond_to?(:each) %>
<%- i = 1 %>
<%- magic_insights.each do |an_object| %>
<%- row_class = i % 2 == 0 ? 'even' : 'odd'
details = an_object.respond_to?(:children) && !an_object.children.empty?
%>
<%= render_template 'magic_insight', :magic_insight => an_object, :row_class => row_class, :details => details %>
<%- if details %>
<%= render_template 'magic_insights', :magic_insights => an_object.children %>
|
<%- end %>
<%- i += 1 %>
<%- end %>
<%- else %>
<%- details = magic_insights.respond_to?(:children) && !magic_insights.children.empty? %>
<%= render_template 'magic_insight', :magic_insight => magic_insights, :row_class => 'odd', :details => details %>
<%- if details %>
<%= render_template 'magic_insights', :magic_insights => magic_insights.children %>
|
<%- end %>
<%- end %>
<%- elsif !magic_insight.nil? %>
Magic Panel Template for <%= magic_insight.class %>
If you want to have the magic panel template render your data first read the warning below
WARNING
<%= Rack::Insight::MagicInsight::WARNING.join('
').gsub(/\s/,' ') %>
If you are sure, do the following in your class to be rendered by this template:
include Rack::Insight::MagicInsight
<%- else %>
nil is non-magical
<%- end %>