Skip to content

Instantly share code, notes, and snippets.

@borisd
Created January 29, 2014 17:57
Show Gist options
  • Save borisd/8693327 to your computer and use it in GitHub Desktop.
Save borisd/8693327 to your computer and use it in GitHub Desktop.
Cats table.html
<ul class="media-grid">
<% @cats.each do |cat| %>
<li class='thumbnail'>
<%= link_to cat_path(cat) do %>
<%= image_tag cat.image.url, alt: cat.name %>
<% end %>
<ul class="controls">
<% if can_like?(cat) %><li><%= link_to 'Like', like_cat_path(cat), method: :post, :class => 'btn btn-mini' %></li><% end %>
<% if can_unlike?(cat) %><li><%= link_to 'UnLike', unlike_cat_path(cat), method: :post, :class => 'btn btn-mini' %></li><% end %>
<% if can_edit?(cat) %><li><%= link_to 'Edit', edit_cat_path(cat), :class => 'btn btn-mini' %></li><% end %>
<% if can_edit?(cat) %><li><%= link_to 'Destroy', cat_path(cat), :method => :delete, :data => { :confirm => 'Are you sure?' }, :class => 'btn btn-mini btn-danger' %></li><% end %>
</ul>
</li>
<% end %>
</ul>
<div style='clear:both'></div>
<%= link_to 'New', new_cat_path, :class => 'btn btn-primary' %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment