publiclab/plots2

View on GitHub
app/views/map/_maps.html.erb

Summary

Maintainability
Test Coverage
<div class="row">
<% @nodes.each_with_index do |node,i| %>
  <div class="col-md-3 clearfix">
    <% if node.main_image %>
      <a class="img-thumbnail" href="<%= node.path %>"><img src="<%= node.main_image.path(:default) %>" style="width:100%;" /></a>
    <% end %>
    <h4><a href="<%= node.path %>"><%= node.title %></a></h4>
    <p style="color:#888;"><small>
      <% if node.map %>
        by <a href="/profile/<%= node.map.authorship %>"><%= node.map.authorship %></a>
      <% end %>
      <% unless !node.map || node.map.captured_on == "" %> <%= time_ago_in_words(node.map.captured_on) %> ago<% end %>
      | <a href="<%= node.path %>#comments"><i style="color:#888;" class="fa fa-comment-o"></i> <%= node.comments.size %></a>
      | <i style="color:#888;" class="fa fa-star-o"></i> <%= node.likes %>
      <% if logged_in_as(['admin']) %>| <%= link_to "/map/delete/"+node.id.to_s, :confirm => 'Are you sure?' do %>
          <i class="fa fa-trash"></i>
        <% end %><% end %>
   </small></p>
  </div>
  <hr class="visible-xs visible-sm" />
<% if ((i+1)/4.0).to_i == ((i+1)/4.0) %>
</div>

<div class="row">
<% end %>
<% end %>
</div>
<div class="text-center">
  <% if @pagy %>
    <%= raw pagy_bootstrap_nav @pagy %>
  <% else %>
    <%= will_paginate @nodes, renderer: WillPaginate::ActionView::BootstrapLinkRenderer unless @unpaginated %>
  <% end %>
</div>