diff --git a/cms/envs/common.py b/cms/envs/common.py index d0ab304b83..51cef45c24 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -2415,3 +2415,7 @@ DEFAULT_EMAIL_LOGO_URL = 'https://edx-cdn.org/v3/default/logo.png' ############## Settings for course import olx validation ############################ COURSE_OLX_VALIDATION_STAGE = 1 COURSE_OLX_VALIDATION_IGNORE_LIST = None + +################# show account activate cta after register ######################## +SHOW_ACTIVATE_CTA_POPUP_COOKIE_NAME = 'show-account-activation-popup' +SHOW_ACCOUNT_ACTIVATION_CTA = False diff --git a/cms/envs/production.py b/cms/envs/production.py index 679cc19295..1ce1a223ae 100644 --- a/cms/envs/production.py +++ b/cms/envs/production.py @@ -608,3 +608,6 @@ COURSE_OLX_VALIDATION_IGNORE_LIST = ENV_TOKENS.get( 'COURSE_OLX_VALIDATION_IGNORE_LIST', COURSE_OLX_VALIDATION_IGNORE_LIST ) + +################# show account activate cta after register ######################## +SHOW_ACCOUNT_ACTIVATION_CTA = ENV_TOKENS.get('SHOW_ACCOUNT_ACTIVATION_CTA', SHOW_ACCOUNT_ACTIVATION_CTA) diff --git a/common/djangoapps/student/views/dashboard.py b/common/djangoapps/student/views/dashboard.py index 34bb107243..779a1320ec 100644 --- a/common/djangoapps/student/views/dashboard.py +++ b/common/djangoapps/student/views/dashboard.py @@ -742,6 +742,8 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem enr for enr in course_enrollments if entitlement.enrollment_course_run.course_id != enr.course_id ] + show_account_activation_popup = request.COOKIES.get(settings.SHOW_ACTIVATE_CTA_POPUP_COOKIE_NAME, None) + context = { 'urls': urls, 'programs_data': programs_data, @@ -771,6 +773,7 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem 'verification_errors': verification_errors, 'denied_banner': denied_banner, 'billing_email': settings.PAYMENT_SUPPORT_EMAIL, + 'show_account_activation_popup': show_account_activation_popup, 'user': user, 'logout_url': reverse('logout'), 'platform_name': platform_name, @@ -830,4 +833,12 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem 'resume_button_urls': resume_button_urls }) - return render_to_response('dashboard.html', context) + response = render_to_response('dashboard.html', context) + if show_account_activation_popup: + response.delete_cookie( + settings.SHOW_ACTIVATE_CTA_POPUP_COOKIE_NAME, + domain=settings.SESSION_COOKIE_DOMAIN, + path='/', + ) + + return response diff --git a/lms/envs/common.py b/lms/envs/common.py index 7f585c3aec..f55fa1c59d 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -4720,3 +4720,13 @@ DEFAULT_EMAIL_LOGO_URL = 'https://edx-cdn.org/v3/default/logo.png' ################# Settings for olx validation. ################# COURSE_OLX_VALIDATION_STAGE = 1 COURSE_OLX_VALIDATION_IGNORE_LIST = None + +################# show account activate cta after register ######################## +SHOW_ACTIVATE_CTA_POPUP_COOKIE_NAME = 'show-account-activation-popup' +# .. toggle_name: SOME_FEATURE_NAME +# .. toggle_implementation: DjangoSetting +# .. toggle_default: False +# .. toggle_description: Flag would be used to show account activation popup after the registration +# .. toggle_use_cases: open_edx +# .. toggle_tickets: https://github.com/edx/edx-platform/pull/27661 +SHOW_ACCOUNT_ACTIVATION_CTA = False diff --git a/lms/envs/production.py b/lms/envs/production.py index 86dff145ed..70bfa038ad 100644 --- a/lms/envs/production.py +++ b/lms/envs/production.py @@ -1056,3 +1056,6 @@ COURSE_OLX_VALIDATION_IGNORE_LIST = ENV_TOKENS.get( 'COURSE_OLX_VALIDATION_IGNORE_LIST', COURSE_OLX_VALIDATION_IGNORE_LIST ) + +################# show account activate cta after register ######################## +SHOW_ACCOUNT_ACTIVATION_CTA = ENV_TOKENS.get('SHOW_ACCOUNT_ACTIVATION_CTA', SHOW_ACCOUNT_ACTIVATION_CTA) diff --git a/lms/static/js/dashboard/legacy.js b/lms/static/js/dashboard/legacy.js index 966dc4c93d..2ad6ac76c2 100644 --- a/lms/static/js/dashboard/legacy.js +++ b/lms/static/js/dashboard/legacy.js @@ -228,6 +228,50 @@ return false; }); + $('#send_cta_email').click(function(e) { + $.ajax({ + type: 'POST', + url: urls.sendAccountActivationEmail, + data: $(this).serializeArray(), + success: function() { + $('#activate-account-modal p svg').remove(); + // xss-lint: disable=javascript-jquery-append + $('#activate-account-modal p').append( + // xss-lint: disable=javascript-concat-html + '' + ); + } + }); + e.preventDefault(); + $('#activate-account-modal p svg').remove(); + // xss-lint: disable=javascript-jquery-append + $('#activate-account-modal p').append( + // xss-lint: disable=javascript-concat-html + '' + ); + }); + + $('#activate-account-modal').on('click', '#button', function() { + $('#activate-account-modal').css('display', 'none'); + $('#lean_overlay').css({display: 'none'}); + }); + if ($('#activate-account-modal').css('display') === 'block') { + $('#lean_overlay').css({ + display: 'block', + 'z-index': 0 + }); + } + $('.action-email-settings').each(function(index) { $(this).attr('id', 'email-settings-' + index); // a bit of a hack, but gets the unique selector for the modal trigger diff --git a/lms/static/sass/multicourse/_dashboard.scss b/lms/static/sass/multicourse/_dashboard.scss index c5ab1c49b3..b12bcd0fca 100644 --- a/lms/static/sass/multicourse/_dashboard.scss +++ b/lms/static/sass/multicourse/_dashboard.scss @@ -1641,6 +1641,59 @@ a.fade-cover { } } +#activate-account-modal { + display: block; + position: fixed; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + margin-top: -60px; + text-align: left; + height: 252px; + width: 450px; + box-shadow: none; + background: none; + + .inner-wrapper { + h3 { + font-family: inherit; + padding: 1.5rem 1rem 1rem 1rem; + text-align: left; + font-weight: bold; + font-size: 1.3rem; + line-height: 1.75rem; + } + border: none; + border-radius: 5px; + } +} + +@media (max-width: 460px) and (min-width: 360px) { + #activate-account-modal { + width: 350px; + } +} + +@media (max-width: 360px) { + #activate-account-modal { + width: 300px; + } +} + +.activate-account-modal-button { + text-align: right; + display: block; + padding: 1rem 1rem 1rem 0; + + .btn-primary { + text-transform: none; + font-weight: 500; + } +} +.activate-account-modal-body { + padding: 0 1rem; +} + .reasons_survey { margin: 20px; diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index b0351a41cb..f9943bc142 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -46,7 +46,9 @@ from common.djangoapps.student.models import CourseEnrollment edx.dashboard.legacy.init({ dashboard: "${reverse('dashboard') | n, js_escaped_string}", signInUser: "${reverse('signin_user') | n, js_escaped_string}", - changeEmailSettings: "${reverse('change_email_settings') | n, js_escaped_string}" + changeEmailSettings: "${reverse('change_email_settings') | n, js_escaped_string}", + sendAccountActivationEmail: "${reverse('send_account_activation_email') | n, js_escaped_string}" + }); }); @@ -316,6 +318,35 @@ from common.djangoapps.student.models import CourseEnrollment +%if show_account_activation_popup: +
+%endif +