publiclab/spectral-workbench

View on GitHub
app/views/graph/_spectra.html.erb

Summary

Maintainability
Test Coverage
<div class="table-scroll-container">
  <table class="table spectra">
    <tr>
      <th style="width:14px;">
        <input class="visible-all" type="checkbox" checked="true" />
      </th>
      <th style="width:14px;"></th>
      <th style="width:14px;">ID</th>
      <th style="width:100px;">Snapshot <a href="//publiclab.org/wiki/spectral-workbench-snapshots"><i style="color:#aaa;" class="fa fa-question-circle"></i></a></th>
      <th style="width:25px;">Tools</th>
      <th style="width:40px;"></th>
      <th><%= spectrums.length if spectrums %> Spectra</th>
      <th>Author</th>
    </tr>
    <% spectrums.each do |spectrum| %>
      <tr class="spectrum spectrum-<%= spectrum.id %>" id="s<%= spectrum.id %>">
        <td style="text-align:center;">
          <input data-id="<%= spectrum.id %>" class="visible" type="checkbox" checked="true" />
        </td>
        <td>
          <div class="key"></div>
        </td>
        <td><%= spectrum.id %></td>
        <td>
          <% if spectrum.snapshots.count.positive? %>
            <%= "##{spectrum.snapshots.last.id}" %>
          <% else %>
            none
          <% end %>
        </td>
        <td><a onClick="$('.spectrum-tools-<%= spectrum.id %>').toggle()"><i class="fa fa-cog"></i></a></td>
        <td>

          <% if spectrum.calibrated %>
            <i rel="tooltip" 
               title="This spectrum is wavelength calibrated!" 
               style="font-size:13px;vertical-align:middle;color:#0c5;" 
               class='fa fa-check-sign'></i>

            <% if spectrum.has_powertag('range') %>
              <a href="//publiclab.org/wiki/spectral-workbench-usage#Wavelength+range">
              <i rel="tooltip" 
                 title="This spectrum is range-limited." 
                 style="font-size:13px;vertical-align:middle;color:#c33;" 
                 class='fa fa-resize-horizontal'></i>
              </a>
            <% end %>

        </td>
        <td>
          <a href="/spectrums/<%= spectrum.id %>"><%= spectrum.title %></a>

          <% else %>
        </td>
        <td>
            <a href="/spectrums/<%= spectrum.id %>"><%= spectrum.title %></a>
            <span style="color:#888;">(calibrate to display)</span>
          <% end %>

        </td>
        <td><a href="/profile/<%= spectrum.user.login %>"><%= spectrum.user.login %></a></td>
      </tr>
      <tr style="display:none;" class="spectrum-tools spectrum-tools-<%= spectrum.id %>"> 
        <td colspan="5">
          <a class="btn btn-small btn-default" href="/sets/remove/<%= datum.id %>?s=<%= spectrum.id %>"><i class="fa fa-remove"></i> Remove from set</a>
        </td>
      </tr>
    <% end %>
  </table>
</div>