publiclab/spectral-workbench

View on GitHub
app/views/spectrums/assign.html.erb

Summary

Maintainability
Test Coverage
<div class="list">
<% @spectrums.each do |spectrum| %>

    <div class="spectrum">


    <% if spectrum.photo.exists? then %>
    <% if spectrum.slice_data_url.nil? %>
    <a href="/spectra/show/<%= spectrum.id %>"><%= image_tag spectrum.photo.url(:thumb) %></a>
    <% else %>
    <a href="/spectra/show/<%= spectrum.id %>"><div src="<%= spectrum.photo.url(:thumb) %>" class="image" style="background:url('<%= spectrum.slice_data_url %>') repeat-y left;"></div></a>
    <% end %>
    <% else %>
    <a href="/spectra/show/<%= spectrum.id %>"><div src="<%= spectrum.photo.url(:thumb) %>" class="image" style="background:#ccc;"></div></a>
    <% end %>
    <div class="text">
      <h3><a href="/spectra/show/<%= spectrum.id %>"><%=h truncate(spectrum.title,:length => 24) %></a></h3>
      <p><a href="/spectra/author/<%=h spectrum.author %>"><%=h spectrum.author %></a> | <%= time_ago_in_words(spectrum.created_at) %> ago</p>
      <p class="notes"><%=h truncate(spectrum.notes,:length => 200) %></p>
      <p>
    <a href="/spectra/<%= spectrum.id %>">View</a> | 
    <%= link_to 'Edit', edit_spectrum_path(spectrum) %> |
    <a href="/spectra/<%= spectrum.id %>#comments"><%= spectrum.comments.length %> comments</a> 
      </p>
  </div>
</div>


<% end %>

</div>
    <hr style="clear:both;"/>
    <br />    
    <a class="button" href="/spectra/assign/<%= params[:id] %>/?claim=true&author=<%= params[:author] %>">Assign these spectra to <%= params[:id] %></a>