calraijintaiko/caltaiko

View on GitHub
erb/performances/_thumbnail_feed.html.erb

Summary

Maintainability
Test Coverage
<section class="thumbnail-feed">
  <% if performances.length > 0 %>
  <% performances.each do |performance| %>
  <article class="thumb-performance">

    <div class="performance-image">
      <%= link_to image_tag(performance.banner.url(:thumb)), performance.link, target: "_blank" %>
      <p><%= link_to "VIEW EVENT", performance.link, target: "_blank" %></p>
    </div>
    <section class="details">
      <p>
        <% if performance.title.length < 34 %>
           <%= performance.title.upcase %>
           <% else %>
           <%= (performance.title[0, 32] + " ...").upcase %>
           <% end %>
      </p>
      <p class="perf-date">
        <%= performance.date.strftime("%-m/%d/%Y") %>
      </p>
    </section>

    <section class="edit-icons">
      <%= link_to image_tag("icons/view.png"), performance_path(performance) %>
      <% if user_signed_in? %>
      <%= link_to image_tag("icons/edit.png"), edit_performance_path(performance) %>
      <%= link_to image_tag("icons/delete.png"),
          performance_path(performance), method: :delete,
          data: { confirm: "Are you sure you'd like to delete performance '" + performance.title + "'?" } %>
      <% end %>
    </section>

  </article>
  <% end %>

  <% else %>
  <div class="text-wrapper">
    <p>Stay tuned for more information soon!</p>
  </div>
  <% end %>

</section>