Skip to content
Snippets Groups Projects
Unverified Commit f32c5138 authored by Dillon Dumesnil's avatar Dillon Dumesnil
Browse files

AA-103: Dates widget enhancements

Reducing dates widget to one assignment. Adding link to dates
page in the dates widget
parent 5f47cb4b
Branches
Tags
No related merge requests found
...@@ -642,6 +642,25 @@ class CourseDateSummaryTest(SharedModuleStoreTestCase): ...@@ -642,6 +642,25 @@ class CourseDateSummaryTest(SharedModuleStoreTestCase):
block = VerificationDeadlineDate(course, user) block = VerificationDeadlineDate(course, user)
self.assertEqual(block.relative_datestring, expected_date_string) 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 @ddt.ddt
class TestDateAlerts(SharedModuleStoreTestCase): class TestDateAlerts(SharedModuleStoreTestCase):
......
...@@ -490,6 +490,14 @@ ...@@ -490,6 +490,14 @@
} }
} }
.dates-tab-link {
padding: 16px 0 0 24px;
a {
font-weight: bold;
}
}
// Course Updates Page // Course Updates Page
.course-updates { .course-updates {
.all-updates { .all-updates {
......
...@@ -13,6 +13,9 @@ from django.utils.translation import ugettext as _ ...@@ -13,6 +13,9 @@ from django.utils.translation import ugettext as _
% for course_date_block in course_date_blocks: % for course_date_block in course_date_blocks:
<%include file="dates-summary.html" args="course_date=course_date_block" /> <%include file="dates-summary.html" args="course_date=course_date_block" />
% endfor % endfor
<div class="dates-tab-link">
<a href="${dates_tab_link}">View all course dates</a>
</div>
% endif % endif
<%static:require_module_async module_name="js/dateutil_factory" class_name="DateUtilFactory"> <%static:require_module_async module_name="js/dateutil_factory" class_name="DateUtilFactory">
......
...@@ -5,6 +5,7 @@ Fragment for rendering the course dates sidebar. ...@@ -5,6 +5,7 @@ Fragment for rendering the course dates sidebar.
from django.http import Http404 from django.http import Http404
from django.template.loader import render_to_string from django.template.loader import render_to_string
from django.urls import reverse
from django.utils.translation import get_language_bidi from django.utils.translation import get_language_bidi
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from web_fragments.fragment import Fragment from web_fragments.fragment import Fragment
...@@ -25,10 +26,11 @@ class CourseDatesFragmentView(EdxFragmentView): ...@@ -25,10 +26,11 @@ class CourseDatesFragmentView(EdxFragmentView):
""" """
course_key = CourseKey.from_string(course_id) course_key = CourseKey.from_string(course_id)
course = get_course_with_access(request.user, 'load', course_key, check_if_enrolled=False) 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 = { 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) html = render_to_string(self.template_name, context)
dates_fragment = Fragment(html) dates_fragment = Fragment(html)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment