AA-3 course dates cleanup

-change Important Course Dates to Upcoming Dates
-remove today's date
-left align date, right aling rest of info
This commit is contained in:
Nicholas D'Alfonso
2019-12-20 14:08:42 -05:00
parent b4eb64a425
commit 3ad963b8a7
8 changed files with 62 additions and 51 deletions

View File

@@ -7,12 +7,13 @@
<%!
from django.utils.translation import ugettext as _
%>
<h3 class="hd hd-6 handouts-header">${_("Important Course Dates")}</h3>
## Should be organized by date, last date appearing at the bottom
% for course_date in course_date_blocks:
<%include file="dates-summary.html" args="course_date=course_date" />
% endfor
% if len(course_date_blocks) > 0:
<h3 class="hd hd-6 handouts-header">${_("Upcoming Dates")}</h3>
## Should be organized by date, last date appearing at the bottom
% for course_date_block in course_date_blocks:
<%include file="dates-summary.html" args="course_date=course_date_block" />
% endfor
% endif
<%static:require_module_async module_name="js/dateutil_factory" class_name="DateUtilFactory">
DateUtilFactory.transform('.localized-datetime');

View File

@@ -4,23 +4,24 @@ from django.utils.translation import ugettext as _
<%page args="course_date" expression_filter="h"/>
<div class="date-summary-container">
<div class="date-summary date-summary-${course_date.css_class}">
% if course_date.title:
% if course_date.title == 'current_datetime':
<span class="hd hd-6 heading localized-datetime" data-datetime="${course_date.date}" data-string="${_(u'Today is {date}')}" data-timezone="${user_timezone}" data-language="${user_language}"></span>
% else:
<div class="left-column">
<div class="calendar-icon"></div>
</div>
<div class="right-column">
% if course_date.date:
<p class="hd hd-6 date localized-datetime" data-format="shortDate" data-datetime="${course_date.date}" data-timezone="${user_timezone}" data-language="${user_language}"></p>
% endif
% if course_date.title:
<span class="hd hd-6 heading">${course_date.title}</span>
% endif
% endif
% if course_date.date and course_date.title != 'current_datetime':
<p class="hd hd-6 date localized-datetime" data-format="shortDate" data-datetime="${course_date.date}" data-timezone="${user_timezone}" data-language="${user_language}" data-string="${_(course_date.relative_datestring)}"></p>
% endif
% if course_date.description:
<p class="description">${course_date.description}</p>
% endif
% if course_date.link and course_date.link_text:
<span class="date-summary-link">
<a href="${course_date.link}">${course_date.link_text}</a>
</span>
% endif
% if course_date.description:
<p class="description">${course_date.description}</p>
% endif
% if course_date.link and course_date.link_text:
<span class="date-summary-link">
<a href="${course_date.link}">${course_date.link_text}</a>
</span>
% endif
</div>
</div>
</div>

View File

@@ -41,7 +41,6 @@ class TestCourseDatesFragmentView(ModuleStoreTestCase):
def test_course_dates_fragment(self):
response = self.client.get(self.dates_fragment_url)
self.assertContains(response, 'Today is')
self.assertContains(response, 'Course End')
self.client.logout()

View File

@@ -70,7 +70,6 @@ from .test_course_updates import create_course_update, remove_course_updates
TEST_PASSWORD = 'test'
TEST_CHAPTER_NAME = 'Test Chapter'
TEST_COURSE_TOOLS = 'Course Tools'
TEST_COURSE_TODAY = 'Today is'
TEST_BANNER_CLASS = '<div class="course-expiration-message">'
TEST_WELCOME_MESSAGE = '<h2>Welcome!</h2>'
TEST_UPDATE_MESSAGE = '<h2>Test Update!</h2>'
@@ -311,7 +310,6 @@ class TestCourseHomePageAccess(CourseHomePageTestCase):
# Verify that the course tools and dates are always shown
self.assertContains(response, TEST_COURSE_TOOLS)
self.assertContains(response, TEST_COURSE_TODAY)
is_anonymous = user_type is CourseUserType.ANONYMOUS
is_enrolled = user_type is CourseUserType.ENROLLED
@@ -365,7 +363,6 @@ class TestCourseHomePageAccess(CourseHomePageTestCase):
# Verify that the course tools and dates are always shown
self.assertContains(response, TEST_COURSE_TOOLS)
self.assertContains(response, TEST_COURSE_TODAY)
# Verify that welcome messages are never shown
self.assertNotContains(response, TEST_WELCOME_MESSAGE)
@@ -639,7 +636,6 @@ class TestCourseHomePageAccess(CourseHomePageTestCase):
response = self.client.get(course_home_url(audit_only_course))
self.assertEqual(response.status_code, 200)
self.assertContains(response, TEST_COURSE_TOOLS)
self.assertContains(response, TEST_COURSE_TODAY)
self.assertNotContains(response, TEST_BANNER_CLASS)
@mock.patch.dict(settings.FEATURES, {'DISABLE_START_DATES': False})

View File

@@ -28,7 +28,7 @@ class CourseDatesFragmentView(EdxFragmentView):
course_date_blocks = get_course_date_blocks(course, request.user)
context = {
'course_date_blocks': course_date_blocks
'course_date_blocks': [block for block in course_date_blocks if block.title != 'current_datetime']
}
html = render_to_string(self.template_name, context)
dates_fragment = Fragment(html)