MakersNetwork/agenda-saude

View on GitHub
app/views/admin/groups/index.html.erb

Summary

Maintainability
Test Coverage
<div class="row">
  <div class="col-10">
    <h1 class="h4">Grupos</h1>
  </div>

  <div class="col-2">
    <%= link_to "Criar grupo", new_admin_group_path, class: 'btn btn-primary btn-block' %>
  </div>
</div>

<table class="table table-bordered table-hover table-sm mt-3">
  <thead class="thead-dark">
  <tr>
    <th scope="col">#</th>
    <th scope="col">Nome</th>
    <th scope="col">Contexto</th>
    <th scope="col">Posição</th>
    <th scope="col">Grupo pai</th>
    <th scope="col">Ativo</th>
  </tr>
  </thead>
  <tbody>
  <% @groups.each do |group| -%>
    <tr data-cy="group" class="<%= "table-dark" unless group.active %>">
      <td>
        <%= link_to group.id, admin_group_path(group) %>
      </td>
      <th scope="row">
        <%= link_to group.name, admin_group_path(group) %>
      </th>
      <td>
        <%= group.context_i18n %>
      </td>
      <td>
        <%= group.position %>
      </td>
      <td>
        <%= group.parent_group ? link_to(group.parent_group.name, admin_group_path(group.parent_group)) : "-" %>
      </td>
      <td>
        <%= group.active ? "Sim" : "Não" %>
      </td>
    </tr>
  <% end -%>
  </tbody>
</table>

<div>
  <%= paginate @groups %>
</div>