diff --git a/lms/djangoapps/courseware/tests/test_date_summary.py b/lms/djangoapps/courseware/tests/test_date_summary.py index d52a2aaca584ae7d1c0fd8460403ae8308b72806..97b1c429795d0da1222db8b03d523ac88f415f43 100644 --- a/lms/djangoapps/courseware/tests/test_date_summary.py +++ b/lms/djangoapps/courseware/tests/test_date_summary.py @@ -642,6 +642,25 @@ class CourseDateSummaryTest(SharedModuleStoreTestCase): block = VerificationDeadlineDate(course, user) self.assertEqual(block.relative_datestring, expected_date_string) + @ddt.data( + 'info', + 'openedx.course_experience.course_home', + ) + @override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=True) + def test_dates_tab_link_render(self, url_name): + with freeze_time('2015-01-02'): + course = create_course_run() + user = create_user() + self.client.login(username=user.username, password=TEST_PASSWORD) + url = reverse(url_name, args=(course.id,)) + response = self.client.get(url, follow=True) + html_elements = [ + 'class="dates-tab-link"', + 'View all course dates</a>', + ] + for html in html_elements: + self.assertContains(response, html) + @ddt.ddt class TestDateAlerts(SharedModuleStoreTestCase): diff --git a/lms/static/sass/features/_course-experience.scss b/lms/static/sass/features/_course-experience.scss index 623820d4a1b572b128557df0e253ecc50a9f69c0..93a970ba6d89d8a9976fae222630450d396b4cf8 100644 --- a/lms/static/sass/features/_course-experience.scss +++ b/lms/static/sass/features/_course-experience.scss @@ -490,6 +490,14 @@ } } +.dates-tab-link { + padding: 16px 0 0 24px; + + a { + font-weight: bold; + } +} + // Course Updates Page .course-updates { .all-updates { diff --git a/openedx/features/course_experience/templates/course_experience/course-dates-fragment.html b/openedx/features/course_experience/templates/course_experience/course-dates-fragment.html index 2464682db75b19e8f16f8ee6ae12f24aea57e296..2ca2de015496ee25e82d107a71e70b7881732585 100644 --- a/openedx/features/course_experience/templates/course_experience/course-dates-fragment.html +++ b/openedx/features/course_experience/templates/course_experience/course-dates-fragment.html @@ -13,6 +13,9 @@ from django.utils.translation import ugettext as _ % for course_date_block in course_date_blocks: <%include file="dates-summary.html" args="course_date=course_date_block" /> % endfor + <div class="dates-tab-link"> + <a href="${dates_tab_link}">View all course dates</a> + </div> % endif <%static:require_module_async module_name="js/dateutil_factory" class_name="DateUtilFactory"> diff --git a/openedx/features/course_experience/views/course_dates.py b/openedx/features/course_experience/views/course_dates.py index aa31068c89598d99ab6ac9aa4f58ffda08740095..a585b56ca26f6f8be86d822ebdd320688aa40cac 100644 --- a/openedx/features/course_experience/views/course_dates.py +++ b/openedx/features/course_experience/views/course_dates.py @@ -5,6 +5,7 @@ Fragment for rendering the course dates sidebar. from django.http import Http404 from django.template.loader import render_to_string +from django.urls import reverse from django.utils.translation import get_language_bidi from opaque_keys.edx.keys import CourseKey from web_fragments.fragment import Fragment @@ -25,10 +26,11 @@ class CourseDatesFragmentView(EdxFragmentView): """ course_key = CourseKey.from_string(course_id) course = get_course_with_access(request.user, 'load', course_key, check_if_enrolled=False) - course_date_blocks = get_course_date_blocks(course, request.user, request, num_assignments=2) + course_date_blocks = get_course_date_blocks(course, request.user, request, num_assignments=1) context = { - 'course_date_blocks': [block for block in course_date_blocks if block.title != 'current_datetime'] + 'course_date_blocks': [block for block in course_date_blocks if block.title != 'current_datetime'], + 'dates_tab_link': reverse('dates', args=[course.id]), } html = render_to_string(self.template_name, context) dates_fragment = Fragment(html)