Guest User

Untitled

a guest
Jul 17th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. <% unless array.blank? %>
  2. <table class="tablified">
  3. <tr>
  4. <th><%= title %></th>
  5. <th style="width:15%;">actions</th>
  6. </tr>
  7. <tr>
  8. <td colspan="2"><%= link_to("Add new #{array[0].class.to_s.singularize}", { :controller => array[0].class.to_s.tableize, :action => "new" }, { :class => "new_link"}) %></td>
  9. </tr>
  10. <% for item in array %>
  11. <tr>
  12. <td><%= link_to(eval("item.#{title}"), item) %></td>
  13. <td>
  14. <%= link_to("Edit", { :controller => item.class.to_s.tableize, :action => "edit", :id => item.id }) %> or
  15. <%= link_to("Delete", item, :method => :delete, :confirm => "Are you sure you want to delete this?\n\nThis cannot be undone.") %>
  16. </td>
  17. </tr>
  18. <% end %>
  19. </table>
  20. <% else %>
  21.  
  22. <% end %>
Add Comment
Please, Sign In to add comment