SOL-236 Manual Enrollments

This commit is contained in:
Muhammad Shoaib
2015-05-22 17:41:23 +05:00
committed by Chris Dodge
parent 9008548c25
commit 65c4f1df89
12 changed files with 666 additions and 47 deletions

View File

@@ -367,6 +367,8 @@ class BatchEnrollment
# gather elements
@$identifier_input = @$container.find("textarea[name='student-ids']")
@$enrollment_button = @$container.find(".enrollment-button")
@$is_course_white_label = @$container.find("#is_course_white_label").val()
@$reason_field = @$container.find("textarea[name='reason-field']")
@$checkbox_autoenroll = @$container.find("input[name='auto-enroll']")
@$checkbox_emailstudents = @$container.find("input[name='email-students']")
@$task_response = @$container.find(".request-response")
@@ -374,12 +376,18 @@ class BatchEnrollment
# attach click handler for enrollment buttons
@$enrollment_button.click (event) =>
if @$is_course_white_label == 'True'
if not @$reason_field.val()
@fail_with_error gettext "Reason field should not be left blank."
return false
emailStudents = @$checkbox_emailstudents.is(':checked')
send_data =
action: $(event.target).data('action') # 'enroll' or 'unenroll'
identifiers: @$identifier_input.val()
auto_enroll: @$checkbox_autoenroll.is(':checked')
email_students: emailStudents
reason: @$reason_field.val()
$.ajax
dataType: 'json'
@@ -393,6 +401,7 @@ class BatchEnrollment
# clear the input text field
clear_input: ->
@$identifier_input.val ''
@$reason_field.val ''
# default for the checkboxes should be checked
@$checkbox_emailstudents.attr('checked', true)
@$checkbox_autoenroll.attr('checked', true)