Skip to content

Instantly share code, notes, and snippets.

@rbirnie
Created November 1, 2012 05:26
Show Gist options
  • Save rbirnie/3992011 to your computer and use it in GitHub Desktop.
Save rbirnie/3992011 to your computer and use it in GitHub Desktop.
Show page with Partials
<% list = @hosts.nil? ? @trend : @hosts %>
<% list.values.includes(:trendable).in_groups(4, false) do |group| %>
<div class="span3">
<td>
<% group.each do |host| -%>
<ul class="base">
<li>
<% opts = host.name? ? host.name : host.fact_value %>
<%= link_to(opts, host_path(:id => opts), :title => "Show Host") %>
</li>
</ul>
<% end %>
</td>
</div>
<% end -%>
<% list = @hosts.nil? ? @trend : @hosts %>
<% list.values.includes(:trendable).in_groups(4, false) do |group| %>
<div class="span3">
<td>
<% group.each do |host| -%>
<ul class="base">
<li>
<%= link_to(host.host, host_path(:host_id => host.host), :title => "Show Host") %>
</li>
</ul>
<% end %>
</td>
</div>
<% end -%>
<% title "Trends for #{trend_title(@trend)}" %>
<% content_for(:search_bar) { trend_days_filter } %>
<%= trend_chart 'trend_graph', "#{trend_title(@trend)}", "last #{range} days", chart_data(@trend, range.days.ago) %>
<table class="table">
<% head = @hosts ? "Hosts" : "Values" %>
<th colspan="4"><%= head %></th>
<tr>
<% if @hosts && @trend.first.is_a?(FactTrend) %>
<%= render fact_hosts %>
<% elsif @hosts %>
<%= render foreman_hosts %>
<% else %>
<%= render trends %>
<% end %>
</tr>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment