Skip to content

Commit

Permalink
feat: add custom behavior for prerequisites.
Browse files Browse the repository at this point in the history
  • Loading branch information
anfbermudezme committed Jan 6, 2022
1 parent 5a25e2d commit f765e1d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,21 +217,44 @@ <h1>
</li>
%endif

% if pre_requisite_courses:
<% prc_target = reverse('about_course', args=[text_type(pre_requisite_courses[0]['key'])]) %>
<li class="prerequisite-course important-dates-item">
<span class="icon fa fa-list-ul" aria-hidden="true"></span>
<p class="important-dates-item-title">${_("Prerequisites")}</p>
## Multiple pre-requisite courses are not supported on frontend that's why we are pulling first element
<span class="important-dates-item-text pre-requisite"><a href="${prc_target}">${pre_requisite_courses[0]['display']}</a></span>
<p class="tip">
${Text(_("You must successfully complete {link_start}{prc_display}{link_end} before you begin this course.")).format(
link_start=HTML('<a href="{}">').format(prc_target),
link_end=HTML('</a>'),
prc_display=pre_requisite_courses[0]['display'],
)}
</p>
</li>
% if course_requirements:
% if student_not_enrollment_in_requirement:
<li class="prerequisite-course important-dates-item">
<span class="icon fa fa-list-ul" aria-hidden="true"></span>
<p class="important-dates-item-title">${_("Prerequisites")}</p>
## Multiple pre-requisite courses are not supported on frontend that's why we are pulling first element
<span class="important-dates-item-text pre-requisite">
<a href="${ecommerce_payment_page}?sku=${student_not_enrollment_in_requirement}">
${course_requirements['display']}
</a>
</span>
<p class="tip">
${Text(_("You must successfully complete {link_start}{prc_display}{link_end} before you begin this course.")).format(
link_start=HTML('<a href="{ecommerce_payment_page}?sku={student_not_enrollment_in_requirement}">').format(
ecommerce_payment_page=ecommerce_payment_page,
student_not_enrollment_in_requirement=student_not_enrollment_in_requirement,
),
link_end=HTML('</a>'),
prc_display=course_requirements['display'],
)}
</p>
</li>
%else:
<% prc_target = reverse('about_course', args=[text_type(course_requirements['key'])]) %>
<li class="prerequisite-course important-dates-item">
<span class="icon fa fa-list-ul" aria-hidden="true"></span>
<p class="important-dates-item-title">${_("Prerequisites")}</p>
## Multiple pre-requisite courses are not supported on frontend that's why we are pulling first element
<span class="important-dates-item-text pre-requisite"><a href="${prc_target}">${course_requirements['display']}</a></span>
<p class="tip">
${Text(_("You must successfully complete {link_start}{prc_display}{link_end} before you begin this course.")).format(
link_start=HTML('<a href="{}">').format(prc_target),
link_end=HTML('</a>'),
prc_display=course_requirements['display'],
)}
</p>
</li>
%endif
% endif

% if get_course_about_section(request, course, "prerequisites"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ <h1>${_("My Courses")}</h1>
is_course_blocked = (session_id in block_courses)
course_verification_status = verification_status_by_course.get(session_id, {})
course_requirements = courses_requirements_not_met.get(session_id)
student_not_enrollment_in_requirement = sku_not_enrollment_in_requirement
student_not_enrollment_in_requirement = sku_not_enrollment_in_requirement.get(session_id)
related_programs = inverted_programs.get(six.text_type(entitlement.course_uuid if is_unfulfilled_entitlement else session_id))
show_consent_link = (session_id in consent_required_courses)
course_overview = enrollment.course_overview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,16 @@ <h4 class="message-title">${_('Your current verification will expire soon.')}</h
% if student_not_enrollment_in_requirement:
## Multiple pre-requisite courses are not supported on frontend that's why we are pulling first element
<div class="prerequisites">
You must successfully complete <a href="${ecommerce_payment_page}?sku=${student_not_enrollment_in_requirement}">${Text(_("{prc_display}")).format(
prc_display=course_requirements['courses'][0]['display'])}</a> before you begin this course.
<p class="tip">
${Text(_("You must successfully complete {link_start}{prc_display}{link_end} before you begin this course.")).format(
link_start=HTML('<a href="{ecommerce_payment_page}?sku={student_not_enrollment_in_requirement}">').format(
ecommerce_payment_page=ecommerce_payment_page,
student_not_enrollment_in_requirement=student_not_enrollment_in_requirement,
),
link_end=HTML('</a>'),
prc_display=course_requirements['courses'][0]['display'],
)}
</p>
</div>
%else:
## Multiple pre-requisite courses are not supported on frontend that's why we are pulling first element
Expand Down

0 comments on commit f765e1d

Please sign in to comment.