Commit 45ed4a41 by Brian Talbot

resolving merge conflict around test_center_register.html template

parents 3bd8f408 2788ad86
......@@ -675,13 +675,18 @@ def _do_create_or_update_test_center_user(post_vars):
try:
testcenter_user.save()
except IntegrityError, ie:
message = "%s" % ie
context = {'course': course,
'user': user,
'message': message,
'testcenteruser': testcenter_user,
}
return render_to_response('test_center_register.html', context)
js = {'success': False}
error_msg = unicode(ie);
# attempt to find a field name to signal
for fieldname in TestCenterUser.user_provided_fields():
if error_msg.find(fieldname) >= 0:
js['value'] = error_msg
js['field'] = fieldname
return HttpResponse(json.dumps(js))
# otherwise just return the error message
js['value'] = error_msg
js['field'] = "General Error"
return HttpResponse(json.dumps(js))
# create and save the registration:
needs_saving = False
......@@ -715,13 +720,7 @@ def _do_create_or_update_test_center_user(post_vars):
try:
registration.save()
except IntegrityError, ie:
message = "%s" % ie
context = {'course': course,
'user': user,
'message': message,
'testcenteruser': testcenter_user,
}
return render_to_response('test_center_register.html', context)
raise
return (user, testcenter_user, registration)
......@@ -743,14 +742,14 @@ def create_test_registration(request, post_override=None):
js['field'] = a
return HttpResponse(json.dumps(js))
# Confirm appropriate fields are there.
# Confirm appropriate fields are filled in with something for now
for a in ['first_name', 'last_name', 'address_1', 'city', 'country']:
if len(post_vars[a]) < 2:
error_str = {'first_name': 'First name must be minimum of two characters long.',
'last_name': 'Last name must be minimum of two characters long.',
'address_1': 'Last name must be minimum of two characters long.',
'city': 'Last name must be minimum of two characters long.',
'country': 'Last name must be minimum of two characters long.',
'address_1': 'Address must be minimum of two characters long.',
'city': 'City must be minimum of two characters long.',
'country': 'Country must be minimum of two characters long.',
}
js['value'] = error_str[a]
js['field'] = a
......@@ -789,9 +788,8 @@ def create_test_registration(request, post_override=None):
# TODO: enable appropriate stat
# statsd.increment("common.student.account_created")
# js = {'success': True}
# return HttpResponse(json.dumps(js), mimetype="application/json")
return HttpResponseRedirect(reverse('dashboard'))
js = {'success': True}
return HttpResponse(json.dumps(js), mimetype="application/json")
def get_random_post_override():
"""
......
......@@ -15,19 +15,13 @@
<script type="text/javascript">
(function() {
$(".unenroll").click(function(event) {
$("#unenroll_course_id").val( $(event.target).data("course-id") );
$("#unenroll_course_number").text( $(event.target).data("course-number") );
});
$(document).delegate('#unenroll_form', 'ajax:success', function(data, json, xhr) {
$(document).on('ajax:success', '#test_register_form', function(data, json, xhr) {
if(json.success) {
location.href="${reverse('dashboard')}";
} else {
if($('#unenroll_error').length == 0) {
$('#unenroll_form').prepend('<div id="unenroll_error" class="modal-form-error"></div>');
}
$('#unenroll_error').text(json.error).stop().css("display", "block");
$(".field.error").removeClass('error');
$('#register_error').html(json.value).stop().css("display", "block");
$("[data-field='"+json.field+"']").addClass('field-error')
}
});
......@@ -147,7 +141,6 @@ exam_info = course.testcenter_info
</div>
<!-- NOTE: BT - registration error message -->
<!-- provide mechanism for error messages to appear -->
% if message:
<div class="message message-status submission-error">
<p class="message-copy">${message}</p>
......@@ -327,7 +320,7 @@ exam_info = course.testcenter_info
if registration.upload_status == 'Accepted':
regstatus = "Registration approved by Pearson"
elif registration.upload_status == 'Error':
regstatus = "rRgistration rejected by Pearson: %s" % registration.upload_error_message
regstatus = "Registration rejected by Pearson: %s" % registration.upload_error_message
elif len(registration.accommodation_request) > 0 and registration.accommodation_code == '':
regstatus = "Pending approval of accommodation request"
%>
......@@ -365,7 +358,7 @@ exam_info = course.testcenter_info
% endif
</p>
</div>
<div class="details details-registration">
<!-- NOTE: showing test details -->
<h4>Pearson VUE Test Details</h4>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment