prellele/trame

View on GitHub
app/views/clients/index.html.erb

Summary

Maintainability
Test Coverage
<%- model_class = Client -%>
<div class="page-header">
  <h1 class="header"><%= t '.title', default: t("helpers.titles.index", class: t('clients.clients') ) %></h1>
  <%= link_to t('.new', default: t("helpers.links.new")),
            new_client_path,
            class: 'btn btn-primary btn-header' %>
</div>
<div class="span7">
<table class="table table-striped span6">
  <thead>
  <tr>
    <th><%= model_class.human_attribute_name(:name) %></th>
    <th><%= t '.actions', default: t("helpers.actions") %></th>
  </tr>
  </thead>
  <tbody>
  <% @clients.each do |client| %>
      <tr>
        <td><%= client.name %></td>
        <td>
          <div class="btn-group">
          <% if allow?("clients","show",client) %>
            <%= link_to t('action.show'), client_path(client), class: 'btn btn-mini' %>
          <% end %>
          <% if allow?("clients","edit",client) %>
            <%= link_to t('action.edit'), edit_client_path(client), class: 'btn btn-mini btn-warning' %>
          <% end %>
          </div>
        </td>
      </tr>
  <% end %>
  </tbody>
</table>
</div>