education/classroom

View on GitHub
app/views/orgs/rosters/_select_identifier_modal.html.erb

Summary

Maintainability
Test Coverage
<% view = FormView.new(subject: roster) %>
<% identifiers = local_assigns.fetch(:identifiers, {}) %>
<% lms_name = local_assigns.fetch(:lms_name, "your learning management system") %>

<div class="remodal text-left" data-remodal-id="select-identifier-modal">
  <button data-remodal-action="close" class="remodal-close"><%= octicon 'x' %></button>
  <h2 class="remodal-header text-left">Sync Roster from <%= lms_name %></h2>

    <div class="my-3">
      <% if identifiers.present? %>
        <%= form_with url: add_students_roster_path(current_organization), method: :patch do |f| %>
          <div class="Box">
            <dl class="Box-header">
              <h3 class="Box-title">Choose how to identify each imported student</h3>
              <dt class="Box-subtitle">Select from the choices below</dt>
            </dl>
            <ul>
              <%= hidden_field_tag "lms_user_ids", @student_ids %>
              <% identifiers.each_pair do |identifier_type, ids| %>
                <li class="Box-row">
                  <%= f.radio_button :identifiers, ids.join("\r\n") %>&nbsp;
                  <%= f.label :identifiers, identifier_type %>
                </li>
              <% end %>
            </ul>
            <%= render('shared/form_error', errors: view.error_message_for(:roster_entries)) if view.errors_for?(:roster_entries) %>
          </div>
          <div class="d-flex flex-items-center border-top pt-5">
            <%= submit_tag 'Import roster entries', class: 'btn btn-primary mr-3' %>
          </div>
        <% end %>
      <% else %>
        <div class="markdown-body">
          GitHub Classroom received an empty roster from <%= lms_name %>. Please ensure you
          have enabled GitHub Classroom to receive student information per your privacy settings
          from within <%= lms_name %> and try again.
        </div>
        <div class="d-flex flex-items-center pt-3">
          <%= link_to "Cancel", "#", { "data-remodal-action": "close" } %>
        </div>
      <% end %>
    </div>
  </div>