education/classroom

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

Summary

Maintainability
Test Coverage
<% view = FormView.new(subject: @roster) %>

<%= render 'organizations/organization_banner', settings: true %>

<div class="site-content">
  <div class="site-content-cap">
    <h1 class="site-content-heading">Add students</h1>
  </div>
  <div class="site-content-body">
    <div class="markdown-body">
      <p>Let's set up a roster so you can easily track student progress on your dashboard. You can always come back and complete this step later.</p>
    </div>
    <div class="my-3">
      <h2 class="h3 mb-2">Import students from your institution</h2>
      <% if current_organization.lti_configuration %>
        <% lms_name = current_organization.lti_configuration.lms_name(default_name: "your learning management system") %>
        <p>It looks like you are connected to <%= lms_name %>. GitHub Classroom can automatically import your roster for you!</p>

        <%= link_to image_tag('other-logo.png', size: "25", class:"mr-2") + "Import from #{lms_name}",
          import_from_lms_roster_path,
          class: "btn btn-secondary d-inline-flex flex-items-center mb-3"
        %>
      <% elsif current_organization.google_course_id %>
        <p>It looks like you are connected to Google Classroom. GitHub Classroom can automatically import your roster for you!</p>
        <%= link_to image_tag('google-classroom-logo.png', size: "25", class:"mr-2") + "Import from Google Classroom",
          import_from_google_classroom_roster_path(current_organization),
          method: :patch,
          class: "btn btn-secondary d-inline-flex flex-items-center mb-3"
        %>
      <% else %>
        <p>GitHub Classroom is able to automatically import your roster from your institution. If you
        would rather manage your roster manually, you can still do that, too.</p>

        <%= link_to image_tag('other-logo.png', size: "25", class:"mr-2") + "Import from a learning management system",
          link_lms_organization_path,
          class: "btn btn-secondary d-inline-flex flex-items-center mb-3"
        %>
      <% end %>
    </div>

    <div class="my-3">
      <% if !current_organization.lti_configuration && !current_organization.google_course_id %>
        <h2 class="h3 mb-2">Manually add students</h2>
        <div>
          <%= form_tag roster_path(current_organization), method: :post do |f| %>
            <div class="Box">
              <dl class="Box-body <%= view.form_class_for(:roster_entries) %> mb-0">
                <dt class="text-gray mb-1">Enter your list of students' identifiers, <strong>one per line</strong>.</dt>
                <dd><%= text_area_tag(:identifiers, '', class: 'form-control input-block', id: 'entries-field', required: true) %></dd>
                <%= render('shared/form_error', errors: view.error_message_for(:roster_entries)) if view.errors_for?(:roster_entries) %>
              </dl>

              <div class="Box-footer bg-gray">
                <label class='btn btn-secondary btn-sm' for="file-upload">Upload a CSV or text file</label>
                <%= file_field_tag :identifiers_file, style: 'display: none', id: 'file-upload', onchange: 'onIdentifiersUploaded()' %>
              </div>
            </div>

            <div class="d-flex flex-items-center border-top pt-5">
              <%= submit_tag 'Create roster', class: 'btn btn-primary mr-3' %>
              <%= link_to 'Skip', organization_path(current_organization), class: 'btn-link' %>
            </div>
          <% end %>
        </div>
      <% else %>
        <div class="d-flex flex-items-center border-top pt-5">
          <%= link_to 'Skip', organization_path(current_organization), class: 'btn-link' %>
        </div>
      <% end %>
    </div>
  </div>
</div>