18F/identity-dashboard

View on GitHub
app/views/teams/edit.html.erb

Summary

Maintainability
Test Coverage
<h1 class="usa-display">Edit team</h1>


<%= simple_form_for(@team, html: { autocomplete: 'off', class: 'usa-form usa-form--large' }) do |form| %>
  <%= form.error_notification %>
  <%= render 'form', form: form, agency_required: false, extra_message: t('headings.teams.temporary_warning_team_user') %>

  <div>
    <h2><label for="users">Users: (<%= @team.users.count %>)</label></h2>
    <ul class="font-mono-xs margin-top-0 usa-list usa-list--unstyled" name="users">
      <% @team.users.each do |u| %>
        <li><%= u.email %></li>
      <% end %>
    </ul>
    <%= hidden_field_tag "user_ids", [@team.users.map(&:id)] %>
    <%= link_to(
      "Manage users",
      team_users_path(@team),
      class: 'margin-y-1 display-block',
    ) %>
  </div>

  <div>
    <%= form.button :submit, 'Update', class: "usa-button" %>

    <%= link_to t('forms.buttons.cancel'), teams_path,
                  class: 'usa-button usa-button--outline' %>
  </div>
<% end %>

<% if can_delete_team?(current_user) %>
  <%= button_to(
          'Delete',
          team_path(@team),
          method: :delete,
          form_class: 'margin-top-1',
          data: { confirm: 'Are you sure you want to delete this team?' },
          class: 'usa-button usa-button--danger display-inline',
          )
  %>
<% end %>