app/views/group_assignments/_group_assignment_form_options.html.erb
<% view = FormView.new(subject: @group_assignment, organization: @organization) %>
<dl class="<%= view.form_class_for(:title) %>">
<dt><%= f.label :title %></dt>
<dd><%= f.text_field :title, class: 'textfield form-control input-contrast input-block', autocomplete: :off %></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 form-control input-contrast input-block', autocomplete: :off %></dd>
<%= render('shared/form_error', errors: view.error_message_for(:slug)) if view.errors_for?(:slug) %>
<p class="f6 text-gray my-2"><%= t('assignment_form.slug_note') %></p>
</dl>
<dl class="<%= view.form_class_for(:public_repo) %> my-4">
<div class="form-checkbox">
<label>
<%= f.radio_button :visibility, "public", checked: view.public_is_checked? %>
<div class="d-flex">
<div>
<%= octicon 'repo', height: 32, class: "text-gray mr-2" %>
</div>
<div>
Public
<span class="d-block f6 text-gray text-normal mt-1">Submit assignments using public repositories. All submissions will be visible to the world.</span>
</div>
</div>
</label>
</div>
<div class="form-checkbox">
<label>
<%= f.radio_button :visibility, "private", checked: !view.public_is_checked?, disabled: !view.private_repos_available? %>
<div class="d-flex">
<div>
<%= octicon 'lock', height: 32, class: "text-orange mr-2" %>
</div>
<div>
Private
<span class="d-block f6 text-gray text-normal mt-1">
<p<%= " style=color: #6A737D" unless view.private_repos_available? %>">
Submit assignments using private repositories. Submissions will only be visible to the submitter and organization owners. Editing this after assignments are created will not retroactively change their visibility.
</p>
<% unless view.private_repos_available? %>
<strong>
<p>Private repositories aren't available for this organization. However, current faculty may be eligible for free, unlimited private repositories.</p>
<p><%= link_to "Apply for free private repositories", "https://education.github.com/discount_requests/new" %></p>
</strong>
<% end %>
</span>
</div>
</div>
</label>
</div>
<%= render('shared/form_error', errors: view.error_message_for(:public_repo)) if view.errors_for?(:public_repo) %>
</dl>
<% 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-group">
<%= select :group_assignment, :grouping_id, options_for_select(@groupings), { include_blank: true }, { class: 'form-select'} %>
</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 form-control input-contrast input-block" type="text" value="<%= suggested_name unless groupings_present %>" placeholder="<%= suggested_name if groupings_present %>" name="grouping[title]" id="grouping_title" autocomplete="off"></dd>
<%= render('shared/form_error', errors: view.error_message_for_object(@group_assignment.grouping)) if view.errors_for_object?(@group_assignment.grouping) %>
</dl>
<% end %>
<div class="Box my-4">
<div class="Box-header">
<h3 class="Box-title">Optional</h3>
</div>
<div class="Box-body">
<% unless GitHubClassroom.enterprise? %>
<dl class="<%= view.form_class_for(:starter_code_repository) %>">
<dt><label>Add starter code</label></dt>
<dd>
<%= f.text_field :starter_code_repository,
class: "textfield js-autocomplete-textfield form-control input-contrast input-block",
name: "repo_name",
type: "text",
value: @group_assignment.starter_code_repository.try(:full_name),
placeholder: @group_assignment.starter_code_repository.try(:full_name) ||
'Find a GitHub repository…',
autocomplete: "off",
oninput: "importOptions(this.value);removeErrorBox(this);",
data: { "autocomplete-search-endpoint": "github_repos" }
%>
</dd>
<dd class="dd-autocomplete-suggestions"><%= render_autocomplete_suggestions_container %></dd>
<input class="js-autocomplete-resource-id form-control input-contrast input-block" type="hidden" name="repo_id" />
<%= render('shared/form_error', errors: view.error_message_for(:starter_code_repository)) if view.errors_for?(:starter_code_repository) %>
<div id="import-options" style=<%= "display:none;" if not @group_assignment.starter_code? %>>
<div class="form-checkbox">
<label><%= f.radio_button :template_repos_enabled, true, checked: (true if @group_assignment.new_record? || @group_assignment.template_repos_enabled?) %> Import starter code using a template repository</label>
<span class="Label border border-green text-gray-dark">Beta</span>
<span class="note col-md-9">Starter code repository must be a <%= link_to "template repository", "https://help.github.com/en/articles/creating-a-template-repository", target: "_blank" %>. Importing from a template repository speeds up code import and student repository creation.</span>
</div>
<div class="form-checkbox">
<label><%= f.radio_button :template_repos_enabled, false %> Import starter code using source importer</label>
<span class="note">Slower than template repository method, but the repository doesn't need to be a template.</span>
</div>
</div>
</dl>
<% end %>
<hr class="pt-3"/>
<h4 class="pt-2">Team options</h4>
<dl class="<%= view.form_class_for(:max_members) %>">
<dt><%= f.label "Maximum number of members in each team" %></dt>
<dd><%= f.number_field :max_members, class: 'textfield form-control input-contrast input-block', autocomplete: :off %></dd>
<%= render 'shared/form_error', errors: view.error_message_for(:max_members) if view.errors_for?(:max_members) %>
</dl>
<dl class="<%= view.form_class_for(:max_teams) %>">
<dt><%= f.label "Maximum number of teams" %></dt>
<dd><%= f.number_field :max_teams, class: 'textfield form-control input-contrast input-block', autocomplete: :off %></dd>
<%= render 'shared/form_error', errors: view.error_message_for(:max_teams) if view.errors_for?(:max_teams) %>
</dl>
<hr class="pt-3"/>
<dl class="<%= view.form_class_for(:deadline) %> mb-0">
<dt class="pt-2"><label>Deadline</label></dt>
<dd><%= f.text_field :deadline, class: 'jquery-datetimepicker form-control input-contrast input-block', value: DeadlineFormatHelper.convert(f.object.deadline), autocomplete: :off %></dd>
<%= render('shared/form_error', errors: view.error_message_for(:deadline)) if view.errors_for?(:deadline) %>
<dd class="col-md-10 text-small text-gray my-2">After the deadline, GitHub Classroom will save the latest commit from each repository as a submission. Submission commits are viewable on the assignment page.</dd>
</dl>
<hr class="pt-2"/>
<dl class="form-group">
<h4 class="h5 pt-2">Enable assignment invitation link</h4>
<div class="form-checkbox">
<label>
<%= f.check_box :invitations_enabled %>
Enable assignment invitation URL <span class="tooltipped tooltipped-no-delay tooltipped-n tooltipped-multiline d-inline-block pl-1" aria-label="While enabled, students will be able to accept and access this assignment. When you no longer want anyone to access this assignment, uncheck to deactivate the invitation link."><%= octicon "info" %></span>
</label>
<p class="text-small text-normal text-gray mt-1">
While enabled, anyone with access to the link will be able to accept and access this assignment
</p>
</div>
</dl>
<hr class="pt-2"/>
<dl class="form-group">
<h4 class="h5 pt-2">Student admin access</h4>
<div class="form-checkbox">
<label>
<%= f.check_box :students_are_repo_admins %>
Grant students admin access on their repository
<div class="f6 text-gray text-normal mt-1">Editing this after assignments are created will not retroactively change their permissions.</div>
</label>
</div>
</dl>
</div>
</div>