Fix content gating a11y issues
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
<div class="content-paywall">
|
||||
<div class="content-paywall" role="group" aria-label="{% trans 'Content available only to verified track learners' %}">
|
||||
<div>
|
||||
<h3>
|
||||
<span class="fa fa-lock" aria-hidden="true"></span>
|
||||
{% trans "Verified Track Access" %}
|
||||
</h3>
|
||||
<span style=" padding: 10px 0;">
|
||||
<span class="certSPAN_1">
|
||||
{% trans "Graded assessments are available to Verified Track learners." %}
|
||||
</span>
|
||||
{% if not mobile_app and ecommerce_checkout_link %}
|
||||
<span class="certDIV_1" style="">
|
||||
<a href="{{ecommerce_checkout_link}}" class="certA_2">
|
||||
<a href="{{ecommerce_checkout_link}}" class="certA_1">
|
||||
{% trans "Upgrade to unlock" %} (${{min_price}} USD)
|
||||
</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<img src="{% static 'images/edx-verified-mini-cert.png' %}">
|
||||
<img src="{% static 'images/edx-verified-mini-cert.png' %}" alt="">
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,7 @@ from lms.djangoapps.courseware.masquerade import get_course_masquerade, is_masqu
|
||||
from openedx.core.djangoapps.catalog.utils import get_course_run_details
|
||||
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
|
||||
from openedx.core.djangoapps.util.user_messages import PageLevelMessages
|
||||
from openedx.core.djangolib.markup import HTML
|
||||
from openedx.core.djangolib.markup import HTML, Text
|
||||
from openedx.features.course_duration_limits.models import CourseDurationLimitConfig
|
||||
|
||||
MIN_DURATION = timedelta(weeks=4)
|
||||
@@ -132,11 +132,18 @@ def register_course_expired_message(request, course):
|
||||
)
|
||||
else:
|
||||
upgrade_message = _('Your access to this course expires on {expiration_date}. \
|
||||
<a href="{upgrade_link}">Upgrade now</a> for unlimited access.')
|
||||
{a_open}Upgrade now {sronly_span_open}to retain access past {expiration_date}.\
|
||||
{span_close}{a_close}{sighted_only_span_open}for unlimited access.{span_close}')
|
||||
PageLevelMessages.register_info_message(
|
||||
request,
|
||||
HTML(upgrade_message).format(
|
||||
Text(upgrade_message).format(
|
||||
a_open=HTML('<a href="{upgrade_link}">').format(
|
||||
upgrade_link=verified_upgrade_deadline_link(user=request.user, course=course)
|
||||
),
|
||||
sronly_span_open=HTML('<span class="sr-only">'),
|
||||
sighted_only_span_open=HTML('<span aria-hidden="true">'),
|
||||
span_close=HTML('</span>'),
|
||||
a_close=HTML('</a>'),
|
||||
expiration_date=expiration_date.strftime('%b %-d'),
|
||||
upgrade_link=verified_upgrade_deadline_link(user=request.user, course=course)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -266,7 +266,7 @@ class TestCourseHomePageAccess(CourseHomePageTestCase):
|
||||
self.assertContains(response, TEST_WELCOME_MESSAGE, count=expected_count)
|
||||
|
||||
# Verify that the expected message is shown to the user
|
||||
self.assertContains(response, '<div class="user-messages">', count=1 if expected_message else 0)
|
||||
self.assertContains(response, '<div class="user-messages"', count=1 if expected_message else 0)
|
||||
if expected_message:
|
||||
self.assertContains(response, expected_message)
|
||||
|
||||
@@ -306,7 +306,7 @@ class TestCourseHomePageAccess(CourseHomePageTestCase):
|
||||
self.assertContains(response, 'Learn About Verified Certificate', count=(1 if is_enrolled else 0))
|
||||
|
||||
# Verify that the expected message is shown to the user
|
||||
self.assertContains(response, '<div class="user-messages">', count=1 if expected_message else 0)
|
||||
self.assertContains(response, '<div class="user-messages"', count=1 if expected_message else 0)
|
||||
if expected_message:
|
||||
self.assertContains(response, expected_message)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user