jipiboily/monologue

View on GitHub
app/views/monologue/admin/users/index.html.erb

Summary

Maintainability
Test Coverage
<h2><%= link_to t(".create"), new_admin_user_path, class: "btn btn-success" %></h2>

<table class="table table-striped table-bordered">
  <thead>
  <tr>
    <th><%= t(".name") %></th>
    <th><%= t(".email") %></th>
    <th></th>
    <th></th>
  </tr>
  </thead>
  <tbody>
  <% @users.each do |user| %>
    <tr>
      <td><%= user.name %></td>
      <td><%= user.email %></td>
      <td><%= link_to t(".edit"), edit_admin_user_path(user), class: "btn btn-small" %></td>
      <td>
        <% if monologue_current_user.can_delete?(user) %>
          <%= link_to t(".delete"), [:admin, user], data: { confirm: 'Are you sure?' }, method: :delete, class: "btn btn-small btn-danger" %>
        <% else %>
          <a href="#" class="btn btn-small btn-danger disabled"><%= t(".delete") %></a>
        <% end %>
      </td>
    </tr>
  <% end %>
  </tbody>
</table>