From 37ed10103cf218d444f50113129e32240b7d485f Mon Sep 17 00:00:00 2001 From: Jillian Vogel Date: Tue, 3 Apr 2018 21:12:10 +0930 Subject: [PATCH] Shows the account activation message in the main content area if HIDE_DASHBOARD_COURSES_UNTIL_ACTIVATED is enabled. (cherry picked from commit 761acdfc6d55e3aff25e661318c840e35a5a66db) --- common/djangoapps/student/views/dashboard.py | 27 ++++++++++------ lms/templates/dashboard.html | 32 +++++++++++-------- .../account_activation_sidebar_notice.html | 15 +-------- 3 files changed, 36 insertions(+), 38 deletions(-) diff --git a/common/djangoapps/student/views/dashboard.py b/common/djangoapps/student/views/dashboard.py index b40477b444..6b64f1dcec 100644 --- a/common/djangoapps/student/views/dashboard.py +++ b/common/djangoapps/student/views/dashboard.py @@ -40,6 +40,7 @@ from openedx.core.djangoapps.programs.utils import ProgramDataExtender, ProgramP from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers from openedx.core.djangoapps.util.maintenance_banner import add_maintenance_banner from openedx.core.djangoapps.waffle_utils import WaffleFlag, WaffleFlagNamespace +from openedx.core.djangolib.markup import HTML, Text from openedx.features.enterprise_support.api import get_dashboard_consent_notification from shoppingcart.api import order_history from shoppingcart.models import CourseRegistrationCode, DonationConfiguration @@ -609,16 +610,21 @@ def student_dashboard(request): ) course_optouts = Optout.objects.filter(user=user).values_list('course_id', flat=True) - # Display activation message in sidebar - sidebar_account_activation_message = '' + # Display activation message + activate_account_message = '' if not user.is_active: - sidebar_account_activation_message = render_to_string( - 'registration/account_activation_sidebar_notice.html', - { - 'email': user.email, - 'platform_name': platform_name, - 'activation_email_support_link': activation_email_support_link - } + activate_account_message = Text(_( + "Check your {email_start}{email}{email_end} inbox for an account activation link from {platform_name}. " + "If you need help, contact {link_start}{platform_name} Support{link_end}." + )).format( + platform_name=platform_name, + email_start=HTML(""), + email_end=HTML(""), + email=user.email, + link_start=HTML("").format( + activation_email_support_link=activation_email_support_link, + ), + link_end=HTML(""), ) enterprise_message = get_dashboard_consent_notification(request, user, course_enrollments) @@ -784,12 +790,12 @@ def student_dashboard(request): 'enrollment_message': enrollment_message, 'redirect_message': redirect_message, 'account_activation_messages': account_activation_messages, + 'activate_account_message': activate_account_message, 'course_enrollments': course_enrollments, 'course_entitlements': course_entitlements, 'course_entitlement_available_sessions': course_entitlement_available_sessions, 'unfulfilled_entitlement_pseudo_sessions': unfulfilled_entitlement_pseudo_sessions, 'course_optouts': course_optouts, - 'sidebar_account_activation_message': sidebar_account_activation_message, 'staff_access': staff_access, 'errored_courses': errored_courses, 'show_courseware_links_for': show_courseware_links_for, @@ -819,6 +825,7 @@ def student_dashboard(request): 'disable_courseware_js': True, 'display_course_modes_on_dashboard': enable_verified_certificates and display_course_modes_on_dashboard, 'display_sidebar_on_dashboard': display_sidebar_on_dashboard, + 'display_sidebar_account_activation_message': (not user.is_active and not hide_dashboard_courses_until_activated), 'display_dashboard_courses': (user.is_active or not hide_dashboard_courses_until_activated), 'empty_dashboard_message': empty_dashboard_message, } diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index e520894571..5369c2e9f2 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -122,10 +122,11 @@ from student.models import CourseEnrollment
- % if display_dashboard_courses:
+ % if display_dashboard_courses: <%include file="learner_dashboard/_dashboard_navigation_courses.html"/> + % endif % if len(course_entitlements + course_enrollments) > 0:
    @@ -195,16 +196,20 @@ from student.models import CourseEnrollment
% else:
-

${_("You are not enrolled in any courses yet.")}

- % if empty_dashboard_message: -

${empty_dashboard_message | n, decode.utf8}

- %endif - % if settings.FEATURES.get('COURSES_ARE_BROWSABLE'): - - ${_("Explore courses")} - - - %endif + % if display_dashboard_courses: +

${_("You are not enrolled in any courses yet.")}

+ % if empty_dashboard_message: +

${empty_dashboard_message | n, decode.utf8}

+ %endif + % if settings.FEATURES.get('COURSES_ARE_BROWSABLE'): + + ${_("Explore courses")} + + %endif + % else: +

${_("Activate your account!")}

+

${ activate_account_message | n, decode.utf8 }

+ % endif
% endif @@ -226,11 +231,10 @@ from student.models import CourseEnrollment % endif
- % endif
- %if sidebar_account_activation_message: + %if display_sidebar_account_activation_message: %endif diff --git a/lms/templates/registration/account_activation_sidebar_notice.html b/lms/templates/registration/account_activation_sidebar_notice.html index 5fc1a8ca75..be474707d2 100644 --- a/lms/templates/registration/account_activation_sidebar_notice.html +++ b/lms/templates/registration/account_activation_sidebar_notice.html @@ -15,20 +15,7 @@ from openedx.core.djangolib.markup import HTML, Text Notice ${_("Activate your account!")} -

${Text(_( - "Check your {email_start}{email}{email_end} inbox for an account activation link from {platform_name}. " - "If you need help, contact {link_start}{platform_name} Support{link_end}." - )).format( - platform_name=platform_name, - email_start=HTML(""), - email_end=HTML(""), - email=email, - link_start=HTML("").format( - activation_email_support_link=activation_email_support_link, - ), - link_end=HTML(""), - )} -

+

${ activate_account_message | n, decode.utf8 }

## TODO: Add resend activation email functionality. ## TODO: Implementation of this is part of ENT-353. ##