flower-pot/veterator

View on GitHub
app/views/records/index.html.erb

Summary

Maintainability
Test Coverage
<div class="panel-heading">
  <div class="row">
    <div class="col-sm-9">
      <h2><%= t 'sensor.records' %> <small><%= t 'sensor.for_sensor', sensor_title: @sensor.title %></small></h2>
    </div>
    <div class="col-sm-3">
      <%= link_to export_sensor_records_url(@sensor, format: 'csv', from: @from, to: @to), class: 'btn btn-block btn-primary pull-right' do %>
        <i class="icon mdi-file-file-download"></i> <%= t 'sensor.export' %>
      <%- end %>
    </div>
  </div>
</div>

<div class="panel-body">
  <% if @records.empty? %>
    <%= render 'sensors/no_records' %>
  <% else %>
  <table class="table table-striped">
    <thead>
      <tr>
        <th><%= t 'sensor.timestamp' %></th>
        <th><%= t 'sensor.value' %></th>
      </tr>
    </thead>
    <tbody>
    <% @records.each do |record| %>
      <tr>
        <td><%= l record.created_at, format: :full %></td>
        <td><%= record.value %></td>
      </tr>
    <% end %>
    </tbody>
  </table>
  <% end %>
</div>