BathHacked/energy-sparks

View on GitHub
app/views/admin/analysis/generic_chart_template.html.erb

Summary

Maintainability
Test Coverage
<% content_for :page_title do %>Energy Analysis for <%= @school.name %><% end %>

<h1>Energy Analysis</h1>
<p><%= link_to @school.name, school_path(@school) %> is a <%= @school.school_type %> school near <%= @school.postcode %>
<% if @school.number_of_pupils && @school.floor_area %>
with <%= @school.number_of_pupils %> pupils and a floor area of <%= @school.floor_area %>m<sup>2</sup>.
<% else %>
. Please <%= link_to 'edit the school details', edit_school_path(@school) %> and add the number of pupils and the school floor area in m<sup>2</sup> for more accurate analysis.
<% end %>
</p>

<%= render 'shared/measurement_picker', measurement_options: @measurement_options, measurement: @measurement if @show_measurement_units %>

<%= render 'nav' %>

<% @charts.each_with_index do |chart, index| %>
  <% unless index == 0 %>
    <hr class="analysis"/>
  <% end %>
  <div id="chart_wrapper_<%= chart %>" class="chart-wrapper">
    <div class="dynamic-titles">
      <h3 class="analysis">Loading: <%= chart.to_s.humanize %></h3>
    </div>
    <div class="advice-header"></div>
    <%= component 'chart', chart_type: chart.to_s, analysis_controls: true, school: @school, chart_config: @chart_config.merge!(show_advice: true) %>
    <div class="advice-footer"></div>
  </div>
<% end %>