flower-pot/veterator

View on GitHub
app/views/sensors/show.html.erb

Summary

Maintainability
Test Coverage
<div class="panel-heading">
  <h2>
    <span><%= @sensor.title %></span>
    <small><%= @sensor.description %></small>
  </h2>
</div>

<div class="panel-body">
  <% if @records.empty? %>
    <%= render 'no_records' %>
  <% else %>
    <svg id="graph"></svg>
    <div class="row">
      <div class="col-sm-2 col-sm-offset-7">
        <p class="text-right"><strong><%= t 'sensor.timestamp' %></strong></p>
        <p class="text-right"><strong><%= t 'sensor.value' %></strong></p>
      </div>
      <div class="col-sm-3">
        <p><span id="created_at"></span></p>
        <p><span id="value"></span> </p>
      </div>
    </div>
    <script>new Chart(<%= @sensor.id %>, "#graph", "<%= @sensor.chart_type %>", true).initialize();</script>
  <% end %>
</div>