18F/hhs-acf-uc-dashboard

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

Summary

Maintainability
Test Coverage
<div class='devise-form'>
  <h2>Add new user</h2>

  <p>
  Add a new user to the dashboard. You'll be able to modify their permissions later.
  The new user will receive a notification and be asked to update the password.
  </p>

  <%= form_for([:admin, @view_model.model]) do |f| %>
    <% if !@view_model.errors.empty? %>
      <div class='usa-alert usa-alert-error'>
        <div class='usa-alert-body'>
          <div class='usa-alert-heading'><%= @view_model.errors %></div>
        </div>
      </div>
   <% end %>

    <div class="field">
      <%= f.label :email %>
      <%= f.email_field :email, autofocus: true %>
    </div>

    <div class="field">
      <%= f.label :role %>
      <%= f.select :role, @view_model.role_names, {selected: @view_model.role} %>
    </div>

    <%= f.submit "Create user" %><br>
    <a href="/admin/users">Cancel</a>
  <% end %>
</div>