<commit_before><% title_view_model = FormFieldWithErrors::EditView.new(object: @group_assignment, field: :title) %>
<dl class="<%= title_view_model.form_class %>">
  <dt><%= f.label :title %></dt>
  <dd><%= f.text_field :title, class: 'textfield' %></dd>
  <%= render 'shared/form_error', errors: title_view_model.error_message if title_view_model.errors? %>
</dl>

<% slug_view_model = FormFieldWithErrors::EditView.new(object: @group_assignment, field: :slug) %>
<dl class="<%= slug_view_model.form_class %>">
  <dt><%= f.label :slug %></dt>
  <dd><%= f.text_field :slug, class: 'textfield' %></dd>
  <%= render 'shared/form_error', errors: slug_view_model.error_message if slug_view_model.errors? %>
  <span class="note"><%= t('assignment_form.slug_note') %></span>
</dl>

<dl class="form">
  <div class="form-checkbox">
    <label><%= f.radio_button :public_repo, true %> Public</label>
    <%= octicon 'repo', height: 32 %>
    <span class="note">Submit assignments using public repositories. All submissions will be visible to the world.</span>
  </div>

  <div class="form-checkbox">
    <label><%= f.radio_button :public_repo, false %> Private</label>
    <%= octicon 'lock', height: 32 %>
    <span class="note">Submit assignments using private repositories. Submissions will only be visible to the submitter and organization owners.</span>
  </div>

  <div class="form-checkbox">
    <label><%= f.check_box :students_are_repo_admins %> Give students Admin permissions on their repository</label>
  </div>
</dl>

<dl class="form">
  <dt><label>Add your starter code from GitHub <small>(optional)</small> </label></dt>
  <dd><input class="textfield js-autocomplete-textfield" type="text" name="repo_name" value="<%= @group_assignment.starter_code_repository.try(:full_name) %>" placeholder="<%= @group_assignment.starter_code_repository.try(:full_name) || 'Search repositories'%>" autocomplete="off" data-autocomplete-search-endpoint="github_repos"></dd>
  <dd class="dd-autocomplete-suggestions"><%= render_autocomplete_suggestions_container %></dd>
  <input class="js-autocomplete-resource-id" type="hidden" name="repo_id" />
</dl>

<% max_members_view_model = FormFieldWithErrors::EditView.new(object: @group_assignment, field: :max_members) %>
<dl class="<%= max_members_view_model.form_class %>">
   <dt><%= f.label "Maximum number of members in each team (optional)" %></dt>
   <dd><%= f.number_field :max_members, class: 'textfield' %></dd>
   <%= render 'shared/form_error', errors: max_members_view_model.error_message if max_members_view_model.errors? %>
</dl>

<%= render 'shared/assignment_student_identifier_type_options', assignment: @group_assignment, student_identifier_types: student_identifier_types %>

<% if @group_assignment.new_record? %>
  <% groupings_present = @organization.groupings.present? %>

  <% if groupings_present %>
    <dt><label>Choose an existing set of teams</label></dt>
    <dl class="form">
      <dd>
        <%= select :group_assignment, :grouping_id, options_for_select(@groupings), include_blank: true %>
      </dd>
    </dl>
  <% end %>

  <% grouping_view_model = FormFieldWithErrors::EditView.new(object: @group_assignment, field: :grouping) %>
  <dl class="<%= grouping_view_model.form_class %>">
    <dt><label><%= 'OR' if groupings_present %> Create a new set of teams</label></dt>
    <% time           = Time.zone.now %>
    <% suggested_name = Time.zone.now.strftime("Teams formed on %B #{time.day.ordinalize}, %Y") %>
    <dd><input class="textfield" type="text" value="<%= suggested_name unless groupings_present %>" placeholder="<%= suggested_name if groupings_present %>" name="grouping[title]" id="grouping_title"></dd>
    <%= render 'shared/form_error', errors: grouping_view_model.error_message if grouping_view_model.errors? %>
  </dl>
<% end %><commit_msg>Change group assignments form to use new view model<commit_after><% view = FormView.new(subject: @group_assignment) %>

<dl class="<%= view.form_class_for(:title) %>">
  <dt><%= f.label :title %></dt>
  <dd><%= f.text_field :title, class: 'textfield' %></dd>
  <%= render('shared/form_error', errors: view.error_message_for(:title)) if view.errors_for?(:title) %>
</dl>

<dl class="<%= view.form_class_for(:slug) %>">
  <dt><%= f.label :slug %></dt>
  <dd><%= f.text_field :slug, class: 'textfield' %></dd>
  <%= render('shared/form_error', errors: view.error_message_for(:slug)) if view.errors_for?(:slug) %>
  <span class="note"><%= t('assignment_form.slug_note') %></span>
</dl>

<dl class="form">
  <div class="form-checkbox">
    <label><%= f.radio_button :public_repo, true %> Public</label>
    <%= octicon 'repo', height: 32 %>
    <span class="note">Submit assignments using public repositories. All submissions will be visible to the world.</span>
  </div>

  <div class="form-checkbox">
    <label><%= f.radio_button :public_repo, false %> Private</label>
    <%= octicon 'lock', height: 32 %>
    <span class="note">Submit assignments using private repositories. Submissions will only be visible to the submitter and organization owners.</span>
  </div>

  <div class="form-checkbox">
    <label><%= f.check_box :students_are_repo_admins %> Give students Admin permissions on their repository</label>
  </div>
</dl>

<dl class="form">
  <dt><label>Add your starter code from GitHub <small>(optional)</small> </label></dt>
  <dd><input class="textfield js-autocomplete-textfield" type="text" name="repo_name" value="<%= @group_assignment.starter_code_repository.try(:full_name) %>" placeholder="<%= @group_assignment.starter_code_repository.try(:full_name) || 'Search repositories'%>" autocomplete="off" data-autocomplete-search-endpoint="github_repos"></dd>
  <dd class="dd-autocomplete-suggestions"><%= render_autocomplete_suggestions_container %></dd>
  <input class="js-autocomplete-resource-id" type="hidden" name="repo_id" />
</dl>

<dl class="<%= view.form_class_for(:max_members) %>">
   <dt><%= f.label "Maximum number of members in each team (optional)" %></dt>
   <dd><%= f.number_field :max_members, class: 'textfield' %></dd>
   <%= render 'shared/form_error', errors: view.error_message_for(:max_members) if view.errors_for?(:max_members) %>
</dl>

<%= render 'shared/assignment_student_identifier_type_options', assignment: @group_assignment, student_identifier_types: student_identifier_types %>

<% if @group_assignment.new_record? %>
  <% groupings_present = @organization.groupings.present? %>

  <% if groupings_present %>
    <dt><label>Choose an existing set of teams</label></dt>
    <dl class="form">
      <dd>
        <%= select :group_assignment, :grouping_id, options_for_select(@groupings), include_blank: true %>
      </dd>
    </dl>
  <% end %>

  <dl class="<%= view.form_class_for(:grouping) %>">
    <dt><label><%= 'OR' if groupings_present %> Create a new set of teams</label></dt>
    <% time           = Time.zone.now %>
    <% suggested_name = Time.zone.now.strftime("Teams formed on %B #{time.day.ordinalize}, %Y") %>
    <dd><input class="textfield" type="text" value="<%= suggested_name unless groupings_present %>" placeholder="<%= suggested_name if groupings_present %>" name="grouping[title]" id="grouping_title"></dd>
    <%= render 'shared/form_error', errors: view.error_message_for(:grouping) if view.errors_for?(:grouping) %>
  </dl>
<% end %>
{'fraction_non_alphanumeric': 0.17859577368779822, 'fraction_numerical': 0.0010906612133606, 'mean_word_length': 5.509316770186335, 'pattern_counts': {'":': 0, '<': 216, '<?xml version=': 0, '>': 216, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6615002', 'n_tokens_mistral': 2560, 'n_tokens_neox': 2368, 'n_words': 525}