feat: Add 2U recommendations in dashboard [VAN-1094] (#31026)
This commit is contained in:
committed by
GitHub
parent
62fd296b7c
commit
96f6174d9e
@@ -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
|
||||
|
||||
@@ -18,6 +18,7 @@ from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
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 @@ from openedx.features.enterprise_support.api import (
|
||||
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
|
||||
|
||||
@@ -5252,3 +5252,10 @@ OUTCOME_SURVEYS_EVENTS_ENABLED = True
|
||||
|
||||
######################## 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',
|
||||
}
|
||||
|
||||
178
lms/static/js/learner_dashboard/Static2UCallouts.jsx
Normal file
178
lms/static/js/learner_dashboard/Static2UCallouts.jsx
Normal file
@@ -0,0 +1,178 @@
|
||||
/* global gettext */
|
||||
import React from 'react';
|
||||
|
||||
class Static2UCallouts extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div className="static-callouts-main">
|
||||
<div className="static-callouts-header">
|
||||
<div className="static-callouts-heading">
|
||||
<h2 className="static-callouts-heading-black">
|
||||
{gettext('More opportunities for you')}
|
||||
<h2 className="static-callouts-heading-red">{gettext(' to learn')}</h2>
|
||||
</h2>
|
||||
</div>
|
||||
<p className="static-callouts-subheading">
|
||||
{gettext('We\'ve added 500+ learning opportunities to create one of the world\'s most '
|
||||
+ 'comprehensive free-to-degree online learning platforms.')}
|
||||
</p>
|
||||
</div>
|
||||
<div className="static-callouts-cards">
|
||||
<a
|
||||
href={`${this.props.executiveEducationUrl}?vanguards_click=execed`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={
|
||||
this.props.countryCode !== 'US' ? (
|
||||
'static-callouts-card static-callouts-card-no-bootcamp'
|
||||
) : 'static-callouts-card'
|
||||
}
|
||||
>
|
||||
<div className="static-callouts-card-badge">
|
||||
New
|
||||
</div>
|
||||
<h3 className="static-callouts-card-heading">
|
||||
Executive Education
|
||||
</h3>
|
||||
<div className="static-callouts-card-description">
|
||||
Short courses to develop leadership skills
|
||||
<svg
|
||||
width="30"
|
||||
height="20"
|
||||
viewBox="0 0 20 20"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
role="img"
|
||||
focusable="false"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z" fill="currentColor" />
|
||||
</svg>
|
||||
</div>
|
||||
</a>
|
||||
<div
|
||||
className={
|
||||
this.props.countryCode !== 'US' ? (
|
||||
'static-callouts-cards-divider static-callouts-cards-divider-no-bootcamp'
|
||||
) : 'static-callouts-cards-divider'
|
||||
}
|
||||
>
|
||||
<svg viewBox="2 0 25 95">
|
||||
<path d="M 0 120 l 30 -150" stroke="#EAE6E5" strokeWidth="4" fill="none" />
|
||||
</svg>
|
||||
</div>
|
||||
<a
|
||||
href={`${this.props.mastersDegreeUrl}?vanguards_click=masters`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={
|
||||
this.props.countryCode !== 'US' ? (
|
||||
'static-callouts-card static-callouts-card-no-bootcamp'
|
||||
) : 'static-callouts-card'
|
||||
}
|
||||
>
|
||||
<div className="static-callouts-card-badge">
|
||||
New
|
||||
</div>
|
||||
<h3 className="static-callouts-card-heading">
|
||||
Master’s Degrees
|
||||
</h3>
|
||||
<div className="static-callouts-card-description">
|
||||
Online degree programs from top universities
|
||||
<svg
|
||||
width="30"
|
||||
height="20"
|
||||
viewBox="0 0 20 20"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
role="img"
|
||||
focusable="false"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z" fill="currentColor" />
|
||||
</svg>
|
||||
</div>
|
||||
</a>
|
||||
<div
|
||||
className={
|
||||
this.props.countryCode !== 'US' ? (
|
||||
'static-callouts-cards-divider static-callouts-cards-divider-no-bootcamp'
|
||||
) : 'static-callouts-cards-divider static-callouts-cards-break'
|
||||
}
|
||||
>
|
||||
<svg viewBox="2 0 25 95">
|
||||
<path d="M 0 120 l 30 -150" stroke="#EAE6E5" strokeWidth="4" fill="none" />
|
||||
</svg>
|
||||
</div>
|
||||
<a
|
||||
href={`${this.props.bachelorsDegreeUrl}?vanguards_click=bachelors`}
|
||||
target="_blank" rel="noopener noreferrer"
|
||||
className={
|
||||
this.props.countryCode !== 'US' ? (
|
||||
'static-callouts-card static-callouts-card-no-bootcamp'
|
||||
) : 'static-callouts-card'
|
||||
}
|
||||
>
|
||||
<div className="static-callouts-card-badge">
|
||||
New
|
||||
</div>
|
||||
<h3 className="static-callouts-card-heading">
|
||||
Bachelor’s Degrees
|
||||
</h3>
|
||||
<div className="static-callouts-card-description">
|
||||
Begin or complete a degree; fully online
|
||||
<svg
|
||||
width="30"
|
||||
height="20"
|
||||
viewBox="0 0 20 20"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
role="img"
|
||||
focusable="false"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z" fill="currentColor" />
|
||||
</svg>
|
||||
</div>
|
||||
</a>
|
||||
{this.props.countryCode === 'US' && (
|
||||
<div className="static-callouts-cards-divider">
|
||||
<svg viewBox="2 0 25 95">
|
||||
<path d="M 0 120 l 30 -150" stroke="#EAE6E5" strokeWidth="4" fill="none" />
|
||||
</svg>
|
||||
</div>
|
||||
)}
|
||||
{this.props.countryCode === 'US' && (
|
||||
<a href={`${this.props.bootCampsUrl}?vanguards_click=bootcamps`}
|
||||
target="_blank"
|
||||
className="static-callouts-card">
|
||||
<div className="static-callouts-card-badge">
|
||||
New
|
||||
</div>
|
||||
<h3 className="static-callouts-card-heading">
|
||||
Boot Camps
|
||||
</h3>
|
||||
<div className="static-callouts-card-description">
|
||||
Intensive, hands-on, project-based training
|
||||
<svg
|
||||
width="30"
|
||||
height="20"
|
||||
viewBox="0 0 20 20"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
role="img"
|
||||
focusable="false"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z" fill="currentColor" />
|
||||
</svg>
|
||||
</div>
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export { Static2UCallouts };
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user