From 51f44e02a602915fbfa448434029fe6db7381b7c Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Thu, 3 Oct 2013 11:53:08 -0400 Subject: [PATCH 1/5] Delete Pearson code from the dashboard page. --- lms/templates/dashboard.html | 49 ------------------------------------ 1 file changed, 49 deletions(-) diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index f7e92ccce2..a3c3fd25e0 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -211,55 +211,6 @@ - <% - testcenter_exam_info = course.current_test_center_exam - registration = exam_registrations.get(course.id) - testcenter_register_target = reverse('begin_exam_registration', args=[course.id]) - %> - % if testcenter_exam_info is not None: - - % if registration is None and testcenter_exam_info.is_registering(): -
- ${_("Register for Pearson exam")} -

${_("Registration for the Pearson exam is now open and will close on {end_date}").format(end_date="{}".format(testcenter_exam_info.registration_end_date_text))}

-
- % endif - - % if registration is not None: - % if registration.is_accepted: -
- ${_("Schedule Pearson exam")} -

${_("{link_start}Registration{link_end} number: {number}").format( - link_start=''.format(url=testcenter_register_target), - link_end='', - number=registration.client_candidate_id, - )}

-

${_("Write this down! You'll need it to schedule your exam.")}

-
- % endif - % if registration.is_rejected: -
-

- ${_("Your registration for the Pearson exam has been rejected. Please {link_start}see your registration status details{link_end}.").format( - link_start=''.format(url=testcenter_register_target), - link_end='')} - ${_("Otherwise {link_start}contact edX at {email}{link_end} for further help.").format( - link_start=''.format(email="exam-help@edx.org", about=get_course_about_section(course, 'university'), number=course.display_number_with_default), - link_end='', - email="exam-help@edx.org", - )} -

- % endif - % if not registration.is_accepted and not registration.is_rejected: -
-

${_("Your {link_start}registration for the Pearson exam{link_end} is pending.").format(link_start=''.format(url=testcenter_register_target), link_end='')} - ${_("Within a few days, you should see a confirmation number here, which can be used to schedule your exam.")} -

-
- % endif - % endif - % endif - <% cert_status = cert_statuses.get(course.id) %> From 7ba38c0ff3f3468e8bb2cdeaf32db4420b84c660 Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Thu, 3 Oct 2013 14:08:38 -0400 Subject: [PATCH 2/5] Refactor out logic for individual course listings. --- common/djangoapps/student/views.py | 3 - lms/templates/dashboard.html | 132 +---------------- .../dashboard/dashboard_course_listing.html | 133 ++++++++++++++++++ 3 files changed, 136 insertions(+), 132 deletions(-) create mode 100644 lms/templates/dashboard/dashboard_course_listing.html diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index db2ce5b4a4..8c84d9557e 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -295,8 +295,6 @@ def dashboard(request): cert_statuses = {course.id: cert_info(request.user, course) for course, _enrollment in courses} - exam_registrations = {course.id: exam_registration_info(request.user, course) for course, _enrollment in courses} - # get info w.r.t ExternalAuthMap external_auth_map = None try: @@ -312,7 +310,6 @@ def dashboard(request): 'errored_courses': errored_courses, 'show_courseware_links_for': show_courseware_links_for, 'cert_statuses': cert_statuses, - 'exam_registrations': exam_registrations, } return render_to_response('dashboard.html', context) diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index a3c3fd25e0..d6d708a0c6 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -2,14 +2,6 @@ <%! from django.core.urlresolvers import reverse - from courseware.courses import course_image_url, get_course_about_section - from courseware.access import has_access - from certificates.models import CertificateStatuses - - from xmodule.modulestore import MONGO_MODULESTORE_TYPE - from xmodule.modulestore.django import modulestore - - import waffle %> <%inherit file="main.html" /> @@ -163,127 +155,9 @@ % if len(courses) > 0: diff --git a/lms/templates/dashboard/dashboard_course_listing.html b/lms/templates/dashboard/dashboard_course_listing.html new file mode 100644 index 0000000000..98cdebca3c --- /dev/null +++ b/lms/templates/dashboard/dashboard_course_listing.html @@ -0,0 +1,133 @@ +<%page args="course, enrollment, show_courseware_link, cert_status" /> + +<%! from django.utils.translation import ugettext as _ %> +<%! + from django.core.urlresolvers import reverse + from courseware.courses import course_image_url, get_course_about_section + from courseware.access import has_access + from certificates.models import CertificateStatuses + + from xmodule.modulestore import MONGO_MODULESTORE_TYPE + from xmodule.modulestore.django import modulestore + + import waffle +%> +
  • +
    + <% + if waffle.flag_is_active(request, 'merge_course_tabs'): + course_target = reverse('courseware', args=[course.id]) + else: + course_target = reverse('info', args=[course.id]) + %> + + % if show_courseware_link: + + ${_('{course_number} {course_name} Cover Image').format(course_number=course.number, course_name=course.display_name_with_default) |h} + + % else: +
    + ${_('{course_number} {course_name} Cover Image').format(course_number=course.number, course_name=course.display_name_with_default) | h} +
    + % endif + + % if enrollment.mode == "verified": + + ${_("Enrolled as: ")} + ID Verified Ribbon/Badge + ${_("ID Verified")} + + % endif + +
    +
    +

    + % if course.has_ended(): + ${_("Course Completed - {end_date}").format(end_date=course.end_date_text)} + % elif course.has_started(): + ${_("Course Started - {start_date}").format(start_date=course.start_date_text)} + % else: # hasn't started yet + ${_("Course Starts - {start_date}").format(start_date=course.start_date_text)} + % endif +

    +

    ${get_course_about_section(course, 'university')}

    +

    + % if show_courseware_link: + ${course.display_number_with_default | h} ${course.display_name_with_default} + % else: + ${course.display_number_with_default | h} ${course.display_name_with_default} + % endif +

    +
    + + % if course.has_ended() and cert_status: + <% + if cert_status['status'] == 'generating': + status_css_class = 'course-status-certrendering' + elif cert_status['status'] == 'ready': + status_css_class = 'course-status-certavailable' + elif cert_status['status'] == 'notpassing': + status_css_class = 'course-status-certnotavailable' + else: + status_css_class = 'course-status-processing' + %> +
    + + % if cert_status['status'] == 'processing': +

    ${_("Final course details are being wrapped up at this time. Your final standing will be available shortly.")}

    + % elif cert_status['status'] in ('generating', 'ready', 'notpassing', 'restricted'): +

    ${_("Your final grade:")} + ${"{0:.0f}%".format(float(cert_status['grade'])*100)}. + % if cert_status['status'] == 'notpassing': + ${_("Grade required for a certificate:")} + ${"{0:.0f}%".format(float(course.lowest_passing_grade)*100)}. + % elif cert_status['status'] == 'restricted': +

    + ${_("Your certificate is being held pending confirmation that the issuance of your certificate is in compliance with strict U.S. embargoes on Iran, Cuba, Syria and Sudan. If you think our system has mistakenly identified you as being connected with one of those countries, please let us know by contacting {email}.").format(email='{email}.'.format(email=settings.CONTACT_EMAIL))} +

    + % endif +

    + % endif + + % if cert_status['show_disabled_download_button'] or cert_status['show_download_url'] or cert_status['show_survey_button']: + + % endif +
    + + % endif + + % if show_courseware_link: + % if course.has_ended(): + ${_('View Archived Course')} + % else: + ${_('View Course')} + % endif + % endif + + + + ${_('Unregister')} + +% if settings.MITX_FEATURES['ENABLE_INSTRUCTOR_EMAIL'] and modulestore().get_modulestore_type(course.id) == MONGO_MODULESTORE_TYPE: + + +% endif + +
    +
    +
  • From ed5168ec61079c344a070e9f49df1ec2b866c4ae Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Thu, 3 Oct 2013 16:10:17 -0400 Subject: [PATCH 3/5] Move more dashboard logic into the views --- common/djangoapps/student/views.py | 7 +++++++ lms/templates/dashboard.html | 3 ++- lms/templates/dashboard/dashboard_course_listing.html | 9 ++------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 8c84d9557e..285509bf5a 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -48,6 +48,7 @@ from certificates.models import CertificateStatuses, certificate_status_for_stud from xmodule.course_module import CourseDescriptor from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.modulestore.django import modulestore +from xmodule.modulestore import MONGO_MODULESTORE_TYPE from collections import namedtuple @@ -295,6 +296,11 @@ def dashboard(request): cert_statuses = {course.id: cert_info(request.user, course) for course, _enrollment in courses} + # only show email settings for Mongo course and when bulk email is turned on + show_email_settings_for = frozenset(course.id for course, _enrollment in courses + if (settings.MITX_FEATURES['ENABLE_INSTRUCTOR_EMAIL'] and + modulestore().get_modulestore_type(course.id) == MONGO_MODULESTORE_TYPE)) + # get info w.r.t ExternalAuthMap external_auth_map = None try: @@ -310,6 +316,7 @@ def dashboard(request): 'errored_courses': errored_courses, 'show_courseware_links_for': show_courseware_links_for, 'cert_statuses': cert_statuses, + 'show_email_settings_for': show_email_settings_for, } return render_to_response('dashboard.html', context) diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index d6d708a0c6..725841415a 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -157,7 +157,8 @@ % for course, enrollment in courses: <% show_courseware_link = (course.id in show_courseware_links_for) %> <% cert_status = cert_statuses.get(course.id) %> - <%include file='dashboard/dashboard_course_listing.html' args="course=course, enrollment=enrollment, show_courseware_link=show_courseware_link, cert_status=cert_status" /> + <% show_email_settings = (course.id in show_email_settings_for) %> + <%include file='dashboard/dashboard_course_listing.html' args="course=course, enrollment=enrollment, show_courseware_link=show_courseware_link, cert_status=cert_status, show_email_settings=show_email_settings" /> % endfor diff --git a/lms/templates/dashboard/dashboard_course_listing.html b/lms/templates/dashboard/dashboard_course_listing.html index 98cdebca3c..c51f6e5015 100644 --- a/lms/templates/dashboard/dashboard_course_listing.html +++ b/lms/templates/dashboard/dashboard_course_listing.html @@ -1,4 +1,4 @@ -<%page args="course, enrollment, show_courseware_link, cert_status" /> +<%page args="course, enrollment, show_courseware_link, cert_status, show_email_settings" /> <%! from django.utils.translation import ugettext as _ %> <%! @@ -6,10 +6,6 @@ from courseware.courses import course_image_url, get_course_about_section from courseware.access import has_access from certificates.models import CertificateStatuses - - from xmodule.modulestore import MONGO_MODULESTORE_TYPE - from xmodule.modulestore.django import modulestore - import waffle %>
  • @@ -123,8 +119,7 @@ ${_('Unregister')} -% if settings.MITX_FEATURES['ENABLE_INSTRUCTOR_EMAIL'] and modulestore().get_modulestore_type(course.id) == MONGO_MODULESTORE_TYPE: - +% if show_email_settings: % endif From 6bb2ba283b22175d17a565a57b89641490b52817 Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Thu, 3 Oct 2013 16:34:16 -0400 Subject: [PATCH 4/5] Remove more unnecessary imports --- lms/templates/dashboard/dashboard_course_listing.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/lms/templates/dashboard/dashboard_course_listing.html b/lms/templates/dashboard/dashboard_course_listing.html index c51f6e5015..d4f56b52fa 100644 --- a/lms/templates/dashboard/dashboard_course_listing.html +++ b/lms/templates/dashboard/dashboard_course_listing.html @@ -4,8 +4,6 @@ <%! from django.core.urlresolvers import reverse from courseware.courses import course_image_url, get_course_about_section - from courseware.access import has_access - from certificates.models import CertificateStatuses import waffle %>
  • From 361fbaff038692756ba749572a00189695331b8a Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Fri, 4 Oct 2013 09:16:23 -0400 Subject: [PATCH 5/5] Update CHANGELOG --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 23814b0454..609aa6b7a5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,8 @@ in roughly chronological order, most recent first. Add your entries at or near the top. Include a label indicating the component affected. +LMS: Refactor and clean student dashboard templates. + LMS: Fix issue with CourseMode expiration dates LMS: Add PaidCourseRegistration mode, where payment is required before course registration.