diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 71a6455d83..f2454f5cc6 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 CMS: Add text_customization Dict to advanced settings which can support diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index db2ce5b4a4..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,7 +296,10 @@ 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} + # 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 @@ -312,7 +316,7 @@ def dashboard(request): 'errored_courses': errored_courses, 'show_courseware_links_for': show_courseware_links_for, 'cert_statuses': cert_statuses, - 'exam_registrations': exam_registrations, + '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 f7e92ccce2..725841415a 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,176 +155,10 @@ % 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..d4f56b52fa --- /dev/null +++ b/lms/templates/dashboard/dashboard_course_listing.html @@ -0,0 +1,126 @@ +<%page args="course, enrollment, show_courseware_link, cert_status, show_email_settings" /> + +<%! from django.utils.translation import ugettext as _ %> +<%! + from django.core.urlresolvers import reverse + from courseware.courses import course_image_url, get_course_about_section + 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 show_email_settings: + +% endif + +
    +
    +