testmycode/tmc-server

View on GitHub
app/views/migrate_to_other_course/show.html.erb

Summary

Maintainability
Test Coverage
<h2>Migrate submissions from <%= @old_course.name %> to <%= @to_course.name %> ?</h2>

<div class="jumbotron hero-unit-alert">
  <p class="alert alert-danger">
  By submitting form below, all of your submissions and points will be automatically copied over from <%= @old_course.name %> to <%= @to_course.name %>. This action can only be done <strong>once</strong> and once it's done it cannot be undone!
  <br />
  <br />
    Use this form only when you need to migrate from an course to another, for e.g. cases where you missed a deadline and must migrate to a no deadline version of the course to continue.
  <br />
  <br />
  You must update your client to use the new course!
  <br />
  <br />
  This will take some time. Please wait without refreshing your browser. The request will most likely time out, don't try again, just wait.
  </p>
  <% unless @extra_alert_text.nil? %>
    <p class="alert alert-warning">
      <%= raw @extra_alert_text %>
    </p>
  <% end %>

  <% unless @already_migrated %>
    <%= form_tag(migrate_course_migrate_to_other_course_path, method: :post, class: 'form-horizontal') do  %>

      <div class="form-group">
        <%= label_tag :from_course_name, "Name of the course from where to migrate", class: "control-label" %>
        <div class="controls">
          <%= text_field_tag :from_course_name %>
        </div>
      </div>
      <div class="form-group">
        <%= label_tag :to_course_name, "Name of the course where to migrate", class: "control-label" %>
        <div class="controls">
          <%= text_field_tag :to_course_name %>
        </div>
      </div>
      <div class="form-group">
        <%= label_tag "I've read the above and I'm sure I understand the consequences", nil, class: "control-label" %>
        <div class="controls">
          <%= check_box_tag :im_sure %>
        </div>
      </div>
      <%= hidden_field_tag :to_course, @to_course.id %>
      <%= submit_tag("Migrate all my work", class: "btn btn-danger", data: { confirm: "Are you sure you want to migrate yor submissions to the other course?"}) %>
    <% end %>
  <% else %>
    <p>You have completed the migration!</p>
  <% end %>
</div>