feat!: Removing the long-deprecated legacy course_modes chooser (#36156)

* feat!: Removing the long-deprecated legacy course_modes chooser

`course_modes/choose.html`  (and its corresponding
`_upgrade_button.html`)  were specifically only used for the edge case
where an enterprise user found themselves in the non-enterprise learner
dashboard, and attempted to  enroll in a course outside of the
enterprise flow. Once upon a time, in a 2U-only workflow, the commerce
system would apply specific discounts for users within the said case.
That's no longer true, and it has never been true outside of this one
company.

Removing this template  cleans up a legacy version of a legacy page that
was, realistically, exclusively seen by  employees of 2U,
and nobody else.

Removes:
* The corresponding testsfor behavior only seen in the legacy page.
* A waffle flag since all cases route as if the flag is set: `VALUE_PROP_TRACK_SELECTION_FLAG`: `course_modes.use_new_track_selection`
* Some variables set in  `CourseModeView` which were only ever rendered in the legacy template (`title_content`, `has_credit_upsell`) have been removed from the class.
* There is a high likelihood that the class is still  a target for re-factoring now that the legacy view is gone, but I'm  hesitant to touch something which is not covered by previously existing tests, because the logic around what template gets rendered when is complex.

FIXES: APER-3779
FIXES: #36090
This commit is contained in:
Deborah Kaplan
2025-01-24 07:27:55 -08:00
committed by GitHub
parent 5f13b5ed30
commit da348fa456
4 changed files with 41 additions and 420 deletions

View File

@@ -1,36 +0,0 @@
<%page args="content_gating_enabled, course_duration_limit_enabled, min_price, price_before_discount" expression_filter="h"/>
<%!
from django.utils.translation import gettext as _
from openedx.core.djangolib.markup import HTML, Text
%>
<%namespace name='static' file='../static_content.html'/>
<li class="action action-select">
<input type="hidden" name="contribution" value="${price_before_discount or min_price}" />
% if content_gating_enabled or course_duration_limit_enabled:
<button id="track_selection_upgrade" type="submit" name="verified_mode">
<span>${_('Pursue the Verified Track')}</span>
% else:
<button id="track_selection_upgrade" type="submit" name="verified_mode">
<span>${_('Pursue a Verified Certificate')}</span>
% endif
% if price_before_discount:
(<span class="upgrade-price-string">${currency_symbol}${min_price} ${currency}</span> <del> <span class="upgrade-price-string">${Text('{currency_symbol}{price} {currency}').format(currency_symbol=currency_symbol, price=price_before_discount, currency=currency)}</span></del>)
% else:
(<span class="upgrade-price-string">${currency_symbol}${min_price} ${currency}</span>)
% endif
</button>
</li>
<%static:require_module_async module_name="js/commerce/track_ecommerce_events" class_name="TrackECommerceEvents">
var upgradeLink = $("#track_selection_upgrade");
TrackECommerceEvents.trackUpsellClick(upgradeLink, 'track_selection', {
pageName: "track_selection",
linkType: "button",
linkCategory: "(none)"
});
</%static:require_module_async>

View File

@@ -1,233 +0,0 @@
<%page expression_filter="h"/>
<%inherit file="../main.html" />
<%!
from django.utils.translation import gettext as _
from django.urls import reverse
from openedx.core.djangolib.js_utils import js_escaped_string
from openedx.core.djangolib.markup import HTML, Text
%>
<%block name="bodyclass">register verification-process step-select-track</%block>
<%block name="pagetitle">
${_("Enroll In {course_name} | Choose Your Track").format(course_name=course_name)}
</%block>
<%block name="js_extra">
<script type="text/javascript">
var expandCallback = function(event) {
event.preventDefault();
$(this).next('.expandable-area').slideToggle();
var title = $(this).parent();
title.toggleClass('is-expanded');
if (title.attr("aria-expanded") === "false") {
title.attr("aria-expanded", "true");
} else {
title.attr("aria-expanded", "false");
}
};
$(document).ready(function() {
$('.expandable-area').slideUp();
$('.is-expandable').addClass('is-ready');
$('.is-expandable .title-expand').click(expandCallback);
$('.is-expandable .title-expand').keypress(function(e) {
if (e.which == 13) { // only activate on pressing enter
expandCallback.call(this, e); // make sure that we bind `this` correctly
}
});
$('#contribution-other-amt').focus(function() {
$('#contribution-other').attr('checked',true);
});
% if use_ecommerce_payment_flow:
$('button[name=verified_mode]').click(function(e){
e.preventDefault();
window.location.href = '${ecommerce_payment_page | n, js_escaped_string}?sku=' +
encodeURIComponent('${sku | n, js_escaped_string}') +
'&course_run_key=' + encodeURIComponent('${course_run_key | n, js_escaped_string}');
});
% endif
});
</script>
</%block>
<%block name="content">
% if error:
<div class="wrapper-msg wrapper-msg-error">
<div class=" msg msg-error">
<span class="msg-icon icon fa fa-exclamation-triangle" aria-hidden="true"></span>
<div class="msg-content">
<h3 class="title">${_("Sorry, there was an error when trying to enroll you")}</h3>
<div class="copy">
<p>${error}</p>
</div>
</div>
</div>
</div>
%endif
<div class="container">
<section class="wrapper">
<div class="wrapper-register-choose wrapper-content-main">
<article class="register-choose content-main">
<header class="page-header content-main">
<h3 class="title">
${title_content}
</h3>
</header>
<form class="form-register-choose" method="post" name="enrollment_mode_form" id="enrollment_mode_form">
<%
b_tag_kwargs = {'b_start': HTML('<b>'), 'b_end': HTML('</b>')}
%>
% if "verified" in modes:
<div class="register-choice register-choice-certificate">
<div class="wrapper-copy">
<span class="deco-ribbon"></span>
% if has_credit_upsell:
% if content_gating_enabled or course_duration_limit_enabled:
<h4 class="title">${_("Pursue Academic Credit with the Verified Track")}</h4>
% else:
<h4 class="title">${_("Pursue Academic Credit with a Verified Certificate")}</h4>
% endif
<div class="copy">
<p>${_("Become eligible for academic credit and highlight your new skills and knowledge with a verified certificate. Use this valuable credential to qualify for academic credit, advance your career, or strengthen your school applications.")}</p>
<p>
<div class="wrapper-copy-inline">
<div class="copy-inline">
% if content_gating_enabled or course_duration_limit_enabled:
<h4>${_("Benefits of the Verified Track")}</h4>
<ul>
<li>${Text(_("{b_start}Eligible for credit:{b_end} Receive academic credit after successfully completing the course")).format(**b_tag_kwargs)}</li>
% if course_duration_limit_enabled:
<li>${Text(_("{b_start}Unlimited Course Access: {b_end}Learn at your own pace, and access materials anytime to brush up on what you've learned.")).format(**b_tag_kwargs)}</li>
% endif
% if content_gating_enabled:
<li>${Text(_("{b_start}Graded Assignments: {b_end}Build your skills through graded assignments and projects.")).format(**b_tag_kwargs)}</li>
% endif
<li>${Text(_("{b_start}Easily Sharable: {b_end}Add the certificate to your CV or resumé, or post it directly on LinkedIn.")).format(**b_tag_kwargs)}</li>
</ul>
% else:
<h4>${_("Benefits of a Verified Certificate")}</h4>
<ul>
<li>${Text(_("{b_start}Eligible for credit:{b_end} Receive academic credit after successfully completing the course")).format(**b_tag_kwargs)}</li>
<li>${Text(_("{b_start}Official:{b_end} Receive an instructor-signed certificate with the institution's logo")).format(**b_tag_kwargs)}</li>
<li>${Text(_("{b_start}Easily shareable:{b_end} Add the certificate to your CV or resumé, or post it directly on LinkedIn")).format(**b_tag_kwargs)}</li>
</ul>
% endif
</div>
<div class="copy-inline list-actions">
<ul class="list-actions">
<%include file='_upgrade_button.html' args='content_gating_enabled=content_gating_enabled, course_duration_limit_enabled=course_duration_limit_enabled, currency=currency, currency_symbol=currency_symbol, min_price=min_price, price_before_discount=price_before_discount' />
</ul>
</div>
</div>
</p>
</div>
% else:
% if content_gating_enabled or course_duration_limit_enabled:
<h4 class="title">${_("Pursue the Verified Track")}</h4>
% else:
<h4 class="title">${_("Pursue a Verified Certificate")}</h4>
% endif
<div class="copy">
<p>${_("Highlight your new knowledge and skills with a verified certificate. Use this valuable credential to improve your job prospects and advance your career, or highlight your certificate in school applications.")}</p>
<p>
<div class="wrapper-copy-inline">
<div class="copy-inline">
% if content_gating_enabled or course_duration_limit_enabled:
<h4>${_("Benefits of the Verified Track")}</h4>
<ul>
% if course_duration_limit_enabled:
<li>${Text(_("{b_start}Unlimited Course Access: {b_end}Learn at your own pace, and access materials anytime to brush up on what you've learned.")).format(**b_tag_kwargs)}</li>
% endif
% if content_gating_enabled:
<li>${Text(_("{b_start}Graded Assignments: {b_end}Build your skills through graded assignments and projects.")).format(**b_tag_kwargs)}</li>
% endif
<li>${Text(_("{b_start}Easily Sharable: {b_end}Add the certificate to your CV or resumé, or post it directly on LinkedIn.")).format(**b_tag_kwargs)}</li>
</ul>
% else:
<h4>${_("Benefits of a Verified Certificate")}</h4>
<ul>
<li>${Text(_("{b_start}Official: {b_end}Receive an instructor-signed certificate with the institution's logo")).format(**b_tag_kwargs)}</li>
<li>${Text(_("{b_start}Easily shareable: {b_end}Add the certificate to your CV or resumé, or post it directly on LinkedIn")).format(**b_tag_kwargs)}</li>
<li>${Text(_("{b_start}Motivating: {b_end}Give yourself an additional incentive to complete the course")).format(**b_tag_kwargs)}</li>
</ul>
% endif
</div>
<div class="copy-inline list-actions">
<ul class="list-actions">
<%include file='_upgrade_button.html' args='content_gating_enabled=content_gating_enabled, course_duration_limit_enabled=course_duration_limit_enabled, currency=currency, currency_symbol=currency_symbol, min_price=min_price, price_before_discount=price_before_discount' />
</ul>
</div>
</div>
</p>
</div>
% endif
</div>
</div>
% endif
% if "honor" in modes:
<span class="deco-divider">
<span class="copy">${_("or")}</span>
</span>
<div class="register-choice register-choice-audit">
<div class="wrapper-copy">
<span class="deco-ribbon"></span>
<h4 class="title">${_("Audit This Course")}</h4>
<div class="copy">
<p>${_("Audit this course for free and have complete access to all the course material, activities, tests, and forums.")}</p>
</div>
</div>
<ul class="list-actions">
<li class="action action-select">
<input type="submit" name="honor_mode" value="${_('Audit This Course')}" />
</li>
</ul>
</div>
% elif "audit" in modes:
<span class="deco-divider">
<span class="copy">${_("or")}</span>
</span>
<div class="register-choice register-choice-audit">
<div class="wrapper-copy">
<span class="deco-ribbon"></span>
<h4 class="title">${_("Audit This Course (No Certificate)")}</h4>
<div class="copy">
## Translators: b_start notes the beginning of a section of text bolded for emphasis, and b_end marks the end of the bolded text.
% if content_gating_enabled and course_duration_limit_enabled:
<p>${Text(_("Audit this course for free and have access to course materials and discussions forums. {b_start}This track does not include graded assignments, or unlimited course access.{b_end}")).format(**b_tag_kwargs)}</p>
% elif content_gating_enabled and not course_duration_limit_enabled:
<p>${Text(_("Audit this course for free and have access to course materials and discussions forums. {b_start}This track does not include graded assignments.{b_end}")).format(**b_tag_kwargs)}</p>
% elif not content_gating_enabled and course_duration_limit_enabled:
<p>${Text(_("Audit this course for free and have access to course materials and discussions forums. {b_start}This track does not include unlimited course access.{b_end}")).format(**b_tag_kwargs)}</p>
% else:
<p>${Text(_("Audit this course for free and have complete access to all the course material, activities, tests, and forums. {b_start}Please note that this track does not offer a certificate for learners who earn a passing grade.{b_end}")).format(**b_tag_kwargs)}</p>
% endif
</div>
</div>
<ul class="list-actions">
<li class="action action-select">
<input type="submit" name="audit_mode" value="${_('Audit This Course')}" />
</li>
</ul>
</div>
% endif
<input type="hidden" name="csrfmiddlewaretoken" value="${ csrf_token }">
</form>
</article>
</div> <!-- /wrapper-content-main -->
</section>
</div>
</%block>