Merge pull request #22589 from edx/ndalfonso/AA-3-course-dates-cleanup
AA-3 course dates cleanup
This commit is contained in:
@@ -176,12 +176,9 @@ class CourseDateSummaryTest(SharedModuleStoreTestCase):
|
||||
self.client.login(username=user.username, password=TEST_PASSWORD)
|
||||
|
||||
html_elements = [
|
||||
'<h3 class="hd hd-6 handouts-header">Important Course Dates</h3>',
|
||||
'<h3 class="hd hd-6 handouts-header">Upcoming Dates</h3>',
|
||||
'<div class="date-summary-container">',
|
||||
'<div class="date-summary date-summary-todays-date">',
|
||||
'<span class="hd hd-6 heading localized-datetime"',
|
||||
'data-datetime="2015-01-02 00:00:00+00:00"',
|
||||
u'data-string="Today is {date}"',
|
||||
'<p class="hd hd-6 date localized-datetime"',
|
||||
'data-timezone="None"'
|
||||
]
|
||||
url = reverse(url_name, args=(course.id,))
|
||||
@@ -204,12 +201,9 @@ class CourseDateSummaryTest(SharedModuleStoreTestCase):
|
||||
response = self.client.get(url, follow=True)
|
||||
|
||||
html_elements = [
|
||||
'<h3 class="hd hd-6 handouts-header">Important Course Dates</h3>',
|
||||
'<h3 class="hd hd-6 handouts-header">Upcoming Dates</h3>',
|
||||
'<div class="date-summary-container">',
|
||||
'<div class="date-summary date-summary-todays-date">',
|
||||
'<span class="hd hd-6 heading localized-datetime"',
|
||||
'data-datetime="2015-01-02 00:00:00+00:00"',
|
||||
u'data-string="Today is {date}"',
|
||||
'<p class="hd hd-6 date localized-datetime"',
|
||||
'data-timezone="America/Los_Angeles"'
|
||||
]
|
||||
for html in html_elements:
|
||||
@@ -235,7 +229,6 @@ class CourseDateSummaryTest(SharedModuleStoreTestCase):
|
||||
url = reverse(url_name, args=(course.id,))
|
||||
response = self.client.get(url, follow=True)
|
||||
html_elements = [
|
||||
u'data-string="in 1 day - {date}"',
|
||||
'data-datetime="2015-01-03 00:00:00+00:00"'
|
||||
]
|
||||
for html in html_elements:
|
||||
@@ -255,7 +248,6 @@ class CourseDateSummaryTest(SharedModuleStoreTestCase):
|
||||
url = reverse(url_name, args=(course.id,))
|
||||
response = self.client.get(url, follow=True)
|
||||
html_elements = [
|
||||
u'data-string="in 1 day - {date}"',
|
||||
'data-datetime="2015-01-03 00:00:00+00:00"',
|
||||
'data-timezone="America/Los_Angeles"'
|
||||
]
|
||||
|
||||
1
lms/static/images/calendar-alt-regular.svg
Normal file
1
lms/static/images/calendar-alt-regular.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="calendar-alt" class="svg-inline--fa fa-calendar-alt fa-w-14" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M148 288h-40c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12zm108-12v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm96 0v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm-96 96v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm-96 0v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm192 0v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm96-260v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V112c0-26.5 21.5-48 48-48h48V12c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v52h128V12c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v52h48c26.5 0 48 21.5 48 48zm-48 346V160H48v298c0 3.3 2.7 6 6 6h340c3.3 0 6-2.7 6-6z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -457,9 +457,10 @@ button.accordion-trigger, button.prerequisite-button {
|
||||
.date-summary-container {
|
||||
.date-summary {
|
||||
@include clearfix;
|
||||
@include border-left(3px solid $gray-300);
|
||||
|
||||
padding: $baseline/2;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: $baseline/2 $baseline/2 $baseline/2 0;
|
||||
|
||||
.heading {
|
||||
font-size: 0.9rem;
|
||||
@@ -469,18 +470,38 @@ button.accordion-trigger, button.prerequisite-button {
|
||||
color: theme-color("dark");
|
||||
}
|
||||
|
||||
.description {
|
||||
margin-top: $baseline/2;
|
||||
margin-bottom: $baseline/2;
|
||||
display: inline-block;
|
||||
.left-column {
|
||||
flex: 5%;
|
||||
|
||||
.calendar-icon {
|
||||
margin-top: 3px;
|
||||
height: 1em;
|
||||
width: auto;
|
||||
background: url('#{$static-path}/images/calendar-alt-regular.svg');
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
}
|
||||
|
||||
.date-summary-link {
|
||||
font-weight: $font-semibold;
|
||||
.right-column {
|
||||
flex: 85%;
|
||||
|
||||
a {
|
||||
color: $link-color;
|
||||
font-weight: $font-regular;
|
||||
.localized-datetime {
|
||||
font-weight: $font-weight-bold;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.description {
|
||||
margin-bottom: $baseline/2;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.date-summary-link {
|
||||
font-weight: $font-semibold;
|
||||
|
||||
a {
|
||||
color: $link-color;
|
||||
font-weight: $font-regular;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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})
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user