diff --git a/common/djangoapps/student/toggles.py b/common/djangoapps/student/toggles.py index 6f18354af43b..e28a27395f7a 100644 --- a/common/djangoapps/student/toggles.py +++ b/common/djangoapps/student/toggles.py @@ -23,6 +23,23 @@ def should_show_amplitude_recommendations(): return ENABLE_AMPLITUDE_RECOMMENDATIONS.is_enabled() +# Waffle flag to enable 2U Recommendations +# .. toggle_name: student.enable_2u_recommendations +# .. toggle_implementation: WaffleFlag +# .. toggle_default: False +# .. toggle_description: Supports rollout of a POC for 2U recommendations. +# .. toggle_use_cases: temporary +# .. toggle_creation_date: 2022-09-20 +# .. toggle_target_removal_date: None +# .. toggle_warning: None +# .. toggle_tickets: VAN-1094 +ENABLE_2U_RECOMMENDATIONS_ON_DASHBOARD = WaffleFlag(f'{WAFFLE_FLAG_NAMESPACE}.enable_2u_recommendations', __name__) + + +def should_show_2u_recommendations(): + return ENABLE_2U_RECOMMENDATIONS_ON_DASHBOARD.is_enabled() + + # Waffle flag to enable redesigned course enrollment confirmation email. # .. toggle_name: student.enable_redesign_enrollment_confirmation_email # .. toggle_implementation: WaffleFlag diff --git a/common/djangoapps/student/views/dashboard.py b/common/djangoapps/student/views/dashboard.py index 1e74ba72286f..badc2d7735d9 100644 --- a/common/djangoapps/student/views/dashboard.py +++ b/common/djangoapps/student/views/dashboard.py @@ -18,6 +18,7 @@ from edx_django_utils import monitoring as monitoring_utils from edx_django_utils.plugins import get_plugins_view_context from edx_toggles.toggles import WaffleFlag +from ipware.ip import get_client_ip from opaque_keys.edx.keys import CourseKey from openedx_filters.learning.filters import DashboardRenderStarted from pytz import UTC @@ -50,6 +51,7 @@ get_dashboard_consent_notification, get_enterprise_learner_portal_context, ) +from openedx.core.djangoapps.geoinfo.api import country_code_from_ip from common.djangoapps.student.api import COURSE_DASHBOARD_PLUGIN_VIEW_NAME from common.djangoapps.student.helpers import cert_info, check_verify_status_by_course, get_resume_urls_for_enrollments from common.djangoapps.student.models import ( @@ -778,6 +780,9 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem if fbe_is_on: enrollments_fbe_is_on.append(course_key) + ip_address = get_client_ip(request)[0] + country_code = country_code_from_ip(ip_address).upper() + context = { 'urls': urls, 'programs_data': programs_data, @@ -832,6 +837,7 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem 'course_info': get_dashboard_course_info(user, course_enrollments), # TODO START: clean up as part of REVEM-199 (END) 'disable_unenrollment': disable_unenrollment, + 'country_code': country_code, } # Include enterprise learner portal metadata and messaging diff --git a/lms/envs/common.py b/lms/envs/common.py index b40977507a3b..407fea2b1e2b 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -5252,3 +5252,10 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring ######################## Settings for cancel retirement in Support Tools ######################## COOL_OFF_DAYS = 14 + +URLS_2U_LOBS = { + 'executive_education': 'https://www.edx.org/executive-education', + 'masters_degree': 'https://www.edx.org/masters', + 'bachelors_degree': 'https://www.edx.org/bachelors', + 'boot_camps': 'https://www.edx.org/boot-camps', +} diff --git a/lms/static/js/learner_dashboard/Static2UCallouts.jsx b/lms/static/js/learner_dashboard/Static2UCallouts.jsx new file mode 100644 index 000000000000..ce361f89e9f7 --- /dev/null +++ b/lms/static/js/learner_dashboard/Static2UCallouts.jsx @@ -0,0 +1,178 @@ +/* global gettext */ +import React from 'react'; + +class Static2UCallouts extends React.Component { + render() { + return ( +
+
+
+

+ {gettext('More opportunities for you')} +

{gettext(' to learn')}

+ +
+

+ {gettext('We\'ve added 500+ learning opportunities to create one of the world\'s most ' + + 'comprehensive free-to-degree online learning platforms.')} +

+
+
+ +
+ New +
+

+ Executive Education +

+
+ Short courses to develop leadership skills + +
+
+
+ + + +
+ +
+ New +
+

+ Master’s Degrees +

+
+ Online degree programs from top universities + +
+
+
+ + + +
+ +
+ New +
+

+ Bachelor’s Degrees +

+
+ Begin or complete a degree; fully online + +
+
+ {this.props.countryCode === 'US' && ( +
+ + + +
+ )} + {this.props.countryCode === 'US' && ( + +
+ New +
+

+ Boot Camps +

+
+ Intensive, hands-on, project-based training + +
+
+ )} +
+
+ ); + } +} + +export { Static2UCallouts }; diff --git a/webpack.common.config.js b/webpack.common.config.js index 32d20559a734..ceddc75d3413 100644 --- a/webpack.common.config.js +++ b/webpack.common.config.js @@ -98,6 +98,7 @@ module.exports = Merge.smart({ AxiosJwtTokenService: './lms/static/js/jwt_auth/AxiosJwtTokenService.js', EnterpriseLearnerPortalModal: './lms/static/js/learner_dashboard/EnterpriseLearnerPortalModal.jsx', RecommendationsPanel: './lms/static/js/learner_dashboard/RecommendationsPanel.jsx', + Static2UCallouts: './lms/static/js/learner_dashboard/Static2UCallouts.jsx', // Learner Dashboard EntitlementFactory: './lms/static/js/learner_dashboard/course_entitlement_factory.js',