-
-
- Pursue a verified certificate
- - -
-
-
-
-
- -
-
- Official proof of completion -
- Easily shareable certificate -
- Proven motivator to complete the course -
- Certificate purchases help us continue to offer free courses -
- Upgrade ($100)
-
-
@@ -110,6 +86,21 @@
+
Important Course Dates
diff --git a/openedx/features/course_experience/static/course_experience/js/CourseHome.js b/openedx/features/course_experience/static/course_experience/js/CourseHome.js
index e8c411b8a9..7ee8023cc4 100644
--- a/openedx/features/course_experience/static/course_experience/js/CourseHome.js
+++ b/openedx/features/course_experience/static/course_experience/js/CourseHome.js
@@ -144,75 +144,17 @@ export class CourseHome { // eslint-disable-line import/prefer-default-export
);
}
- /**
- * Persists the collapsed state of the upgrade message. If the message is collapsed,
- * this information is persisted to local storage. Expanding the message *removes* the
- * key from local storage.
- */
- persistUpgradeMessageState(collapsed) {
- if (window.localStorage) {
- if (collapsed) {
- window.localStorage.setItem(this.msgStateStorageKey, true);
- } else {
- window.localStorage.removeItem(this.msgStateStorageKey);
- }
- }
- }
-
configureUpgradeMessage() {
- const $vcMessage = $('.vc-message');
- const $vcDismissToggle = $('.vc-toggle', $vcMessage);
const logEventProperties = { courseRunKey: this.courseRunKey };
- Logger.log('edx.bi.course.upgrade.hero.displayed', logEventProperties);
-
- // Get height of container and button
- let vcHeight = $vcMessage.outerHeight();
-
- // Update based on window
- window.onresize = () => {
- if (!$vcMessage.hasClass('polite')) {
- vcHeight = $vcMessage.outerHeight();
- }
- };
-
- function collapseMessage(duration = 400) {
- $('.vc-fade').fadeOut(duration, () => {
- $vcDismissToggle.text(gettext('Show more')).attr('aria-expanded', false);
- $('.vc-polite-only').fadeIn(duration);
- $vcMessage.height('auto').addClass('polite');
- });
- }
-
- // Use the previously-persisted state to determine the initial display state of the message.
- if (window.localStorage && window.localStorage.getItem(this.msgStateStorageKey)) {
- collapseMessage(0);
- }
- $vcMessage.show();
-
- $vcDismissToggle.click(() => {
- if ($vcMessage.hasClass('polite')) {
- // Expand message
- Logger.log('edx.bi.course.upgrade.hero.expanded', logEventProperties);
- this.persistUpgradeMessageState(false);
-
- $('.vc-fade').fadeOut(400);
- $vcMessage.animate({ height: vcHeight }, 400, () => {
- $vcMessage.height('auto').removeClass('polite');
- $vcDismissToggle.text(gettext('Show less')).attr('aria-expanded', true);
- $('.vc-fade').fadeIn(400);
- });
- } else {
- // Collapse message
- Logger.log('edx.bi.course.upgrade.hero.collapsed', logEventProperties);
- this.persistUpgradeMessageState(true);
- collapseMessage();
- }
+ Logger.log('edx.bi.course.upgrade.sidebarupsell.displayed', logEventProperties);
+ $('.section-upgrade .btn-upgrade').click(() => {
+ Logger.log('edx.bi.course.upgrade.sidebarupsell.clicked', logEventProperties);
+ Logger.log('edx.course.enrollment.upgrade.clicked', { location: 'sidebar-message' });
});
-
- $('.btn-upgrade', $vcMessage).click(() => {
- Logger.log('edx.bi.course.upgrade.hero.clicked', logEventProperties);
- Logger.log('edx.course.enrollment.upgrade.clicked', { location: 'hero' });
+ $('.promo-learn-more').click(() => {
+ $('.action-toggle-verification-sock').click();
+ $('.action-toggle-verification-sock')[0].scrollIntoView({ behavior: 'smooth', alignToTop: true });
});
}
}
diff --git a/openedx/features/course_experience/static/course_experience/js/spec/CourseHome_spec.js b/openedx/features/course_experience/static/course_experience/js/spec/CourseHome_spec.js
index 45958cc5b9..a7c918769b 100644
--- a/openedx/features/course_experience/static/course_experience/js/spec/CourseHome_spec.js
+++ b/openedx/features/course_experience/static/course_experience/js/spec/CourseHome_spec.js
@@ -50,54 +50,21 @@ describe('Course Home factory', () => {
describe('Upgrade message events', () => {
const segmentEventProperties = {
promotion_id: 'courseware_verified_certificate_upsell',
- creative: 'original_hero',
+ creative: 'sidebarupsell',
name: 'In-Course Verification Prompt',
- position: 'hero',
+ position: 'sidebar-message',
};
it('should send events to Segment and edX on initial load', () => {
expect(window.analytics.track).toHaveBeenCalledWith('Promotion Viewed', segmentEventProperties);
- expect(Logger.log).toHaveBeenCalledWith('edx.bi.course.upgrade.hero.displayed', { courseRunKey: runKey });
+ expect(Logger.log).toHaveBeenCalledWith('edx.bi.course.upgrade.sidebarupsell.displayed', { courseRunKey: runKey });
});
it('should send events to Segment and edX after clicking the upgrade button ', () => {
- $('.vc-message .btn-upgrade').click();
+ $('.section-upgrade .btn-upgrade').click();
expect(window.analytics.track).toHaveBeenCalledWith('Promotion Viewed', segmentEventProperties);
- expect(Logger.log).toHaveBeenCalledWith('edx.bi.course.upgrade.hero.clicked', { courseRunKey: runKey });
- expect(Logger.log).toHaveBeenCalledWith('edx.course.enrollment.upgrade.clicked', { location: 'hero' });
- });
- });
-
- describe('upgrade message display toggle', () => {
- let $message;
- let $toggle;
-
- beforeEach(() => {
- $.fx.off = true;
-
- $message = $('.vc-message');
- $toggle = $('.vc-toggle', $message);
- expect($message.length).toEqual(1);
- expect($toggle.length).toEqual(1);
- });
-
- it('hides/shows the message and writes/removes a key from local storage', () => {
- // NOTE (CCB): Ideally this should be two tests--one for collapse, another for expansion.
- // After a couple hours I have been unable to make these two tests pass, probably due to
- // issues with the initial state of local storage.
- expect($message.is(':visible')).toBeTruthy();
- expect($message.hasClass('polite')).toBeFalsy();
- expect($toggle.text().trim()).toEqual('Show less');
-
- $toggle.click();
- expect($message.hasClass('polite')).toBeTruthy();
- expect($toggle.text().trim()).toEqual('Show more');
- expect(window.localStorage.getItem(home.msgStateStorageKey)).toEqual('true');
-
- $toggle.click();
- expect($message.hasClass('polite')).toBeFalsy();
- expect($toggle.text().trim()).toEqual('Show less');
- expect(window.localStorage.getItem(home.msgStateStorageKey)).toBeNull();
+ expect(Logger.log).toHaveBeenCalledWith('edx.bi.course.upgrade.sidebarupsell.clicked', { courseRunKey: runKey });
+ expect(Logger.log).toHaveBeenCalledWith('edx.course.enrollment.upgrade.clicked', { location: 'sidebar-message' });
});
});
});
diff --git a/openedx/features/course_experience/templates/course_experience/course-home-fragment.html b/openedx/features/course_experience/templates/course_experience/course-home-fragment.html
index 3a87bca28e..dc7f460b9f 100644
--- a/openedx/features/course_experience/templates/course_experience/course-home-fragment.html
+++ b/openedx/features/course_experience/templates/course_experience/course-home-fragment.html
@@ -58,40 +58,6 @@ from openedx.features.course_experience import UNIFIED_COURSE_TAB_FLAG, SHOW_REV
-
- % if upgrade_url and upgrade_price:
-
% endif
+ % if upgrade_url and upgrade_price:
+
-
- % endif
-
% if course_home_message_fragment:
${HTML(course_home_message_fragment.body_html())}
% endif
@@ -147,6 +113,23 @@ from openedx.features.course_experience import UNIFIED_COURSE_TAB_FLAG, SHOW_REV
-
-
- Pursue a verified certificate
- - - -
-
-
-
-
- -
-
- ${_("Official proof of completion")} -
- ${_("Easily shareable certificate")} -
- ${_("Proven motivator to complete the course")} -
- ${_("Certificate purchases help us continue to offer free courses")} -
+
+
+ % endif
% if dates_fragment:
${_("Pursue a verified certificate")}
+ +
+
${HTML(dates_fragment.body_html())}
diff --git a/openedx/features/course_experience/tests/views/test_course_home.py b/openedx/features/course_experience/tests/views/test_course_home.py
index 4fea646283..6bced59fbc 100644
--- a/openedx/features/course_experience/tests/views/test_course_home.py
+++ b/openedx/features/course_experience/tests/views/test_course_home.py
@@ -512,15 +512,15 @@ class CourseHomeFragmentViewTests(ModuleStoreTestCase):
def assert_upgrade_message_not_displayed(self):
response = self.client.get(self.url)
- self.assertNotIn('vc-message', response.content)
+ self.assertNotIn('section-upgrade', response.content)
def assert_upgrade_message_displayed(self):
response = self.client.get(self.url)
- self.assertIn('vc-message', response.content)
+ self.assertIn('section-upgrade', response.content)
url = EcommerceService().get_checkout_page_url(self.verified_mode.sku)
- self.assertIn(''.format(price=self.verified_mode.min_price), response.content)
+ self.assertIn('Upgrade (${price})'.format(price=self.verified_mode.min_price), response.content)
def test_no_upgrade_message_if_logged_out(self):
self.client.logout()