BathHacked/energy-sparks

View on GitHub
app/views/schools/temperature_observations/introduction.html.erb

Summary

Maintainability
Test Coverage
<h1><%= t('schools.temperature_observations.introduction.title') %></h1>

<div class="row">
  <div class="col-8">
    <%= t('schools.temperature_observations.introduction.why_are_we_doing_this_html') %>
  </div>
  <div class="col-4">
    <%= image_tag("actions/thermometer.svg", class: "img-fluid") %>
  </div>
</div>

<%= t('schools.temperature_observations.introduction.how_to_carry_out_this_activity_html') %>
<%= t('schools.temperature_observations.introduction.temperature_recording_tips_html') %>

<p><%= t('schools.temperature_observations.introduction.you_will_earn_five_points') %>.</p>

<h2><%= t('schools.temperature_observations.introduction.locations_you_can_add_temperatures') %></h2>
<% if @locations.any? %>
  <p><%= link_to t('schools.temperature_observations.introduction.change_room_names'), school_locations_path(@school) %></p>
  <table class="table">
    <thead>
      <tr>
        <th><%= t('schools.temperature_observations.introduction.name') %></th>
        <th><%= t('schools.temperature_observations.introduction.temperatures_recorded') %></th>
      </tr>
    </thead>
    <tbody>
      <% @locations.each do |location| %>
        <tr scope="row">
          <td><%= location.name %></td>
          <td><%= location.temperature_recordings.count %></td>
        </tr>
      <% end %>
    </tbody>
  </table>
<% else %>
  <p><%= t('schools.temperature_observations.introduction.you_havent_created_any_locations_yet') %></p>
<% end %>

<div class="card">
  <div class="card-body">
    <h3><%= t('schools.temperature_observations.introduction.recording_temperatures_for_a_new_location') %></h3>

    <%= simple_form_for [@school, Location.new] do |f| %>
      <%= f.input :name, as: :string %>
      <%= f.submit class: 'btn' %>
    <% end %>
  </div>
</div>

<h2 class="mt-3"><%= t('schools.temperature_observations.introduction.ready_to_record_your_temperatures') %></h2>

<%= link_to t('schools.temperature_observations.introduction.next'), new_school_temperature_observation_path(@school), class: 'btn' %>