denispeplin/link_to_action

View on GitHub
lib/generators/link_to_action/templates/bootstrap/index.html.erb

Summary

Maintainability
Test Coverage
<h1>Listing <%= plural_table_name %></h1>

<table class="table table-condensed">
  <thead>
    <tr>
  <% attributes.each do |attribute| -%>
      <th><%= attribute.human_name %></th>
  <% end -%>
      <th></th>
    </tr>
  </thead>

  <tbody>
    <%%= content_tag_for(:tr, @<%= plural_table_name %>) do |<%= singular_table_name %>| %>
  <% attributes.each do |attribute| -%>
    <% if attribute.name == 'name' %>
      <td><%%= link_to_show <%= singular_table_name %> %></td>
    <% else %>
      <td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
    <% end -%>
  <% end -%>
       <td><%%= link_to_edit <%= singular_table_name %>, size: :mini %>
      <%%= link_to_destroy <%= singular_table_name %>, size: :mini %></td>
    <%% end %>
  </tbody>
</table>

<%%= link_to_new <%= class_name %> %>