Codeminer42/cm42-central

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

Summary

Maintainability
Test Coverage
<% content_for :title_bar do %>
  <%= link_to t('back'), edit_team_path(current_team), class: "btn btn-primary btn-sm navbar-btn" %>
<% end %>

<div class="row">
  <div class="col-xs-12 col-sm-10 col-sm-offset-1">
    <div class="page-header">
      <h4 class="page-header-title">
        <i class="mi md-20">group</i> <%= t('search user') %>
      </h4>
    </div>
  </div>

  <div class="col-xs-12 col-sm-6 col-sm-offset-3">
    <div class="add-member panel panel-default card">
      <div class="panel-body">
        <%= form_for :user,
          url: team_create_enrollment_path(current_team.slug) do |f| %>

          <div class="form-group">
            <%= f.label :email, class: 'control-label' %>
            <%= f.email_field :email, class: 'form-control auth-form-control', id: 'email_search', required: true %>
          </div>

          <div class="actions pull-right">
            <%= f.submit t('add'), class: 'btn btn-primary btn-form' %>
          </div>
        <% end %>
      </div>
    </div>
  </div>

  <div class="row">
  <% if policy(User).manage? %>
    <div class="col-xs12 col-xs-8 col-sm-offset-2">
      <div class="page-header">
        <h4 class="page-header-title">
          <i class="mi md-20">dashboard</i> <%= t('add new member') %>
        </h4>
      </div>
    </div>

    <div class="col-xs-12 col-sm-4 col-sm-offset-2">

      <div class="add-member panel panel-default card">
        <div class="panel-body">
          <%= form_for @user, url: team_users_path(current_team, @user) do |f| %>

            <%= content_tag :div, class: 'alert alert-danger' do %>
              <%= t('errors.template.header', count: @user.errors.count, model: @user.class.name.humanize) %>

              <ul>
                <% @user.errors.full_messages.each do |msg| %>
                  <li><%= msg %></li>
                <% end %>
              </ul>
            <% end if @user.errors.any? %>

            <div class="form-group">
              <%= f.label :email, class: 'control-label' %>
              <%= f.email_field :email, class: 'form-control auth-form-control', required: true %>
            </div>

            <div class="form-group">
              <%= f.label :name, class: 'control-label' %>
              <%= f.text_field :name, class: 'form-control auth-form-control', required: true %>
            </div>

            <div class="form-group">
              <%= f.label :username, class: 'control-label' %>
              <%= f.text_field :username, class: 'form-control auth-form-control', required: true %>
            </div>

            <div class="form-group">
              <%= f.label :initials, class: 'control-label' %>
              <%= f.text_field :initials, class: 'form-control auth-form-control', required: true %>
            </div>

            <div class="form-group">
              <%= f.label :role, class: 'control-label' %>
              <%= f.select :role, User.role.options, {}, { class: 'form-control auth-form-control', required: true } %>
            </div>

            <div class="actions">
              <%= f.submit 'Add user', class: 'btn btn-primary pull-right' %>
            </div>
          <% end %>
        </div>
      </div>
    </div>
  <% end %>
  </div>
<div>