18F/hhs-acf-uc-dashboard

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

Summary

Maintainability
Test Coverage
<h2>
  Users

  <a class='usa-button float-right' href="/admin/users/new">&plus; Add new user</a>
</h2>

<table>
  <thead>
    <tr>
      <th>Email</th>
      <th>Date email confirmed</th>
      <th>Role</th>
    </tr>
  </thead>
  <tbody>
    <% @view_model.users.each do |user| %>
    <tr class='user-id-<%= user.id %>'>
      <td><%= user.email %></td>
      <td><%= user.confirmed_at %></td>
      <td class='role-form-container'>
        <%= form_for([:admin, user.user], html: {class: 'user-role'}) do |f| %>
          <%= f.select :role, @view_model.role_names, {selected: user.role} %>
          <span class='buttons'>
            <%= f.submit 'Save' %>
            <a href='javascript:void(0)' class='cancel-user-role-change'>Cancel</a>
          </span>
        <% end %>
      </td>
    </tr>
    <% end %>
  </tbody>
</table>