publiclab/spectral-workbench

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

Summary

Maintainability
Test Coverage
<div class="list">
<% @anon_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="<%=h user_path(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> |
    <% if spectrum.author == "anonymous" %><a href="/spectra/edit/<%= spectrum.id %>">Claim this spectrum</a> | <% end %>
    <a href="/spectra/<%= spectrum.id %>#comments"><%= spectrum.comments.length %> comments</a>
      </p>
  </div>
</div>
<% end %>
</div>
<br style="clear:left;" />