BathHacked/energy-sparks

View on GitHub
app/views/pupils/analysis/gas.html.erb

Summary

Maintainability
Test Coverage
<% content_for :page_title, strip_tags(t('pupils.analysis.gas_data_html')) %>

<div class="d-flex justify-content-between align-items-center">
  <div>
    <%= link_to t('common.labels.back'),  pupils_school_analysis_path(@school), class: 'btn btn-rounded' %>
  </div>
  <div>
    <h1><%= t('pupils.analysis.gas_data_html') %></h1>
  </div>
  <div></div>
</div>
<hr />

<h2><%= t('pupils.analysis.i_want_to') %></h2>

<div class="row">

  <%= render 'chart_link', school: @school, energy: :gas, chart_config: {energy: 'Gas', presentation: 'kWh'} do %>
    <%= t('pupils.analysis.find_when_gas_used_html') %>
  <% end %>

  <%= render 'chart_link', school: @school, energy: :gas, chart_config: {energy: 'Gas', presentation: 'Cost'} do %>
    <%= t('pupils.analysis.find_how_much_gas_cost_html') %>
<% end %>

  <%= render 'chart_link', school: @school, energy: :gas, chart_config: {energy: 'Gas', presentation: 'CO2'} do %>
    <%= t('pupils.analysis.find_how_much_co2_generated_html') %>
  <% end %>

  <%= render 'usage_link', school: @school, energy: :gas, usage_config: {period: :weekly} do %>
    <%= t('pupils.analysis.compare_gas_in_2_weeks') %>
  <% end %>

  <%= render 'usage_link', school: @school, energy: :gas, usage_config: {period: :daily} do %>
    <%= t('pupils.analysis.compare_gas_on_2_days') %>
  <% end %>

  <% if @school.filterable_meters(:gas).count > 1 %>
    <%= render 'usage_link', school: @school, energy: :gas, usage_config: {period: :weekly, split_meters: true} do %>
      <%= t('pupils.analysis.compare_gas_use_by_meters') %>
    <% end %>
  <% end %>

</div>

<h2><%= sanitize t('pupils.analysis.i_want_to_look_at') %></h2>

<div class="row">
  <%= render 'chart_link', school: @school, energy: :gas, chart_config: {energy: 'Gas', presentation: 'Pie'}, centre: true do %>
    <div class="p-4">
      <%= fa_icon "chart-pie fa-3x" %>
    </div>
    <%= t('common.pie_charts') %>
  <% end %>

  <%= render 'category_link', school: @school, energy: :gas, category: :gas_bar, category_name: t('common.bar_charts'), icon: 'chart-bar' %>
  <%= render 'category_link', school: @school, energy: :gas, category: :gas_line, category_name: t('common.line_graphs'), icon: 'chart-line' %>
</div>