From dd50ec4e827b31a8d4e1eb2bbfaad1a2a05c4996 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Mon, 26 Aug 2013 14:31:36 -0400 Subject: [PATCH] Merge design and dev JS/UI for verify student --- common/djangoapps/course_modes/views.py | 4 +- lms/djangoapps/verify_student/urls.py | 19 +-- lms/djangoapps/verify_student/views.py | 2 +- lms/templates/courseware/course_about.html | 2 +- .../verify_student/photo_id_upload.html | 2 +- .../verify_student/photo_verification.html | 153 +++++++++++------- .../verify_student/show_requirements.html | 7 +- 7 files changed, 114 insertions(+), 75 deletions(-) diff --git a/common/djangoapps/course_modes/views.py b/common/djangoapps/course_modes/views.py index cd85146254..e6add0e498 100644 --- a/common/djangoapps/course_modes/views.py +++ b/common/djangoapps/course_modes/views.py @@ -58,9 +58,11 @@ class ChooseModeView(View): donation_for_course[course_id] = float(amount) request.session["donation_for_course"] = donation_for_course + # TODO: Check here for minimum pricing + return redirect( "{}?{}".format( - reverse('verify_student_verify'), + reverse('verify_student_show_requirements'), urlencode(dict(course_id=course_id)) ) ) diff --git a/lms/djangoapps/verify_student/urls.py b/lms/djangoapps/verify_student/urls.py index 3f1a35685d..f5fc5d2f7e 100644 --- a/lms/djangoapps/verify_student/urls.py +++ b/lms/djangoapps/verify_student/urls.py @@ -5,11 +5,6 @@ from verify_student import views urlpatterns = patterns( '', - url( - r'^show_requirements', - views.show_requirements, - name="verify_student/show_requirements" - ), url( r'^face_upload', views.face_upload, @@ -29,9 +24,9 @@ urlpatterns = patterns( # The above are what we did for the design mockups, but what we're really # looking at now is: url( - r'^show_verification_page', - views.show_verification_page, - name="verify_student/show_verification_page" + r'^show_requirements', + views.show_requirements, + name="verify_student_show_requirements" ), url( @@ -44,6 +39,12 @@ urlpatterns = patterns( r'^create_order', views.create_order, name="verify_student_create_order" - ) + ), + + url( + r'^show_verification_page', + views.show_verification_page, + name="verify_student/show_verification_page" + ), ) diff --git a/lms/djangoapps/verify_student/views.py b/lms/djangoapps/verify_student/views.py index 78c653bea7..631a54bb93 100644 --- a/lms/djangoapps/verify_student/views.py +++ b/lms/djangoapps/verify_student/views.py @@ -77,7 +77,7 @@ def create_order(request): def show_requirements(request): """This might just be a plain template without a view.""" - context = { "course_id" : "edX/Certs101/2013_Test" } + context = { "course_id" : request.GET.get("course_id") } return render_to_response("verify_student/show_requirements.html", context) def face_upload(request): diff --git a/lms/templates/courseware/course_about.html b/lms/templates/courseware/course_about.html index 62dd2eb60d..17c18c2d90 100644 --- a/lms/templates/courseware/course_about.html +++ b/lms/templates/courseware/course_about.html @@ -101,7 +101,7 @@ %else: ${_("Register for {course.display_number_with_default}").format(course=course) | h} - Mock Verify Enrollment + Mock Verify Enrollment
%endif diff --git a/lms/templates/verify_student/photo_id_upload.html b/lms/templates/verify_student/photo_id_upload.html index 3648b3ab6a..1c8ec47dd7 100644 --- a/lms/templates/verify_student/photo_id_upload.html +++ b/lms/templates/verify_student/photo_id_upload.html @@ -122,7 +122,7 @@ $(document).ready(function() {

- Select Certificate + Select Certificate

diff --git a/lms/templates/verify_student/photo_verification.html b/lms/templates/verify_student/photo_verification.html index bdf7a6d1ab..bb69d04f2a 100644 --- a/lms/templates/verify_student/photo_verification.html +++ b/lms/templates/verify_student/photo_verification.html @@ -93,13 +93,44 @@ }, onVideoFail); } + function initPhotoBlocks() { + // Photo wrapping + $('.block-photo .control-redo').addClass('is-hidden'); + $('.block-photo .control-approve').addClass('is-hidden'); + $('.block-photo .m-btn-primary').addClass('disabled'); + $( "#wrapper-facephoto .control-do" ).click(function(e) { + e.preventDefault(); + $(this).toggleClass('is-hidden'); + $('#wrapper-facephoto .control-redo').toggleClass('is-shown'); + $('#wrapper-facephoto .control-approve').toggleClass('is-shown'); + }); + $( "#wrapper-facephoto .control-approve" ).click(function(e) { + e.preventDefault(); + $(this).addClass('approved'); + $('#wrapper-facephoto .m-btn-primary').removeClass('disabled'); + }); + $( "#wrapper-idphoto .control-do" ).click(function(e) { + e.preventDefault(); + $(this).toggleClass('is-hidden'); + $('#wrapper-idphoto .control-redo').toggleClass('is-shown'); + $('#wrapper-idphoto .control-approve').toggleClass('is-shown'); + }); + $( "#wrapper-idphoto .control-approve" ).click(function(e) { + e.preventDefault(); + $(this).addClass('approved'); + $('#wrapper-idphoto .m-btn-primary').removeClass('disabled'); + }); + } + $(document).ready(function() { $(".carousel-nav").addClass('sr'); $("#pay_button").click(submitToPaymentProcessing); + initPhotoBlocks(); initVideoCapture(); initSnapshotHandler("face"); initSnapshotHandler("photo_id"); + }); @@ -141,12 +172,12 @@