Set missed_deadlines in the course outlines template to simplify the logic in the dates_banner.html

This commit is contained in:
Calen Pennington
2020-05-28 14:47:13 -04:00
parent 0a691f244f
commit 6f568d097c
3 changed files with 7 additions and 15 deletions

View File

@@ -104,20 +104,9 @@ additional_styling_class = 'on-mobile' if is_mobile_app else 'has-button'
% endif
</div>
</%def>
% if (missed_deadlines and (on_dates_tab_as_verified or on_courseware_page)):
% if is_verified:
${reset_dates_banner()}
% elif is_audit:
${upgrade_to_reset_banner()}
% endif
% elif on_dates_tab_as_audit and has_locked_assignments:
% if missed_deadlines:
${upgrade_to_reset_banner()}
% else:
${upgrade_to_complete_graded_banner()}
% endif
% elif on_course_outline_page and (is_audit or is_verified):
## The outline page uses javascript to show the dates banner, so everything below is only displayed when a user has actually missed deadlines
% if on_dates_tab and is_audit and has_locked_assignments and not missed_deadlines:
${upgrade_to_complete_graded_banner()}
% elif missed_deadlines:
% if is_verified:
${reset_dates_banner()}
% elif is_audit:

View File

@@ -27,7 +27,7 @@ dates_banner_displayed = False
%>
<main role="main" class="course-outline" id="main" tabindex="-1">
<div class="dates-banner-wrapper">
% if enrollment_mode and relative_dates_flag_is_enabled and self_paced and not is_course_staff:
% if relative_dates_flag_is_enabled and self_paced and not is_course_staff:
<%include file="/dates_banner.html" />
% endif
</div>

View File

@@ -112,6 +112,9 @@ class CourseOutlineFragmentView(EdxFragmentView):
user=request.user,
course_key=course_key
)
# We use javascript to check whether to actually display this banner, so we let the banner assume
# that deadlines have been missed.
context['missed_deadlines'] = True
html = render_to_string('course_experience/course-outline-fragment.html', context)
return Fragment(html)