BathHacked/energy-sparks

View on GitHub
app/views/schools/advice/total_energy_use/_insights.html.erb

Summary

Maintainability
Test Coverage
<%= component 'notice', status: :neutral do |c| %>
  <% c.with_link do
       link_to advice_t('total_energy_use.insights.intro.link'), learn_more_school_advice_total_energy_use_path(@school)
     end %>
  <%= advice_t('total_energy_use.insights.intro.text') %>
<% end %>

<%= render 'schools/advice/section_title', section_id: 'energy-use',
                                           section_title: advice_t('total_energy_use.insights.energy_use.title') %>

<% if @overview_data %>
  <%= render 'management/schools/overview_data', overview_data: @overview_data, show_savings: false %>
  <%= render 'schools/advice/how_have_we_analysed_your_data_table_caption',
             data_target: 'how-have-we-analysed-your-data-footnotes' %>
<% end %>

<%= render 'schools/advice/section_title', section_id: 'comparison',
                                           section_title: advice_t('total_energy_use.insights.comparison.title') %>

<% if @electricity_benchmarked_usage.present? || @gas_benchmarked_usage.present? %>
  <% if @electricity_benchmarked_usage.present? %>
    <h3><%= t('common.electricity') %></h3>
    <p>
      <%= t('advice_pages.electricity_long_term.insights.comparison.how_do_you_compare',
            school_type: t("common.school_types.#{@school.school_type}")) %>
    </p>
    <div class="col">
      <%= component 'school_comparison', id: 'electricity-comparison', comparison: @electricity_benchmarked_usage do |c| %>
        <% c.with_footer { advice_t('electricity_long_term.insights.comparison.callout_footer') } %>
      <% end %>
    </div>
  <% end %>

  <% if @gas_benchmarked_usage.present? %>
    <h3><%= t('common.gas') %></h3>
    <p>
      <%= t('advice_pages.gas_long_term.insights.comparison.how_do_you_compare',
            school_type: t("common.school_types.#{@school.school_type}")) %>
    </p>
    <div class="col">
      <%= component 'school_comparison', id: 'gas-comparison', comparison: @gas_benchmarked_usage do |c| %>
        <% c.with_footer { advice_t('gas_long_term.insights.comparison.callout_footer') } %>
      <% end %>
    </div>
  <% end %>
<% end %>

<% if @school.school_group.present? %>
  <p>
    <%= advice_t('total_energy_use.insights.comparison.more_detail_html',
                 link: compare_for_school_group_path(:annual_energy_costs_per_pupil, @school)) %>
  </p>
<% end %>