feat: Drop unused render_accordion function and template.

This was referenced by the legacy courseware page so we don't need it
anymore.
This commit is contained in:
Feanil Patel
2025-05-23 16:34:19 -04:00
parent 562df7386c
commit d24f45f3ee
2 changed files with 0 additions and 112 deletions

View File

@@ -115,24 +115,6 @@ class CoursewareIndex(View):
raise Redirect(mfe_url)
def render_accordion(request, course, table_of_contents):
"""
Returns the HTML that renders the navigation for the given course.
Expects the table_of_contents to have data on each chapter and section,
including which ones are active.
"""
context = dict(
[
('toc', table_of_contents),
('course_id', str(course.id)),
('csrf', csrf(request)['csrf_token']),
('due_date_display_format', course.due_date_display_format),
] + list(TEMPLATE_IMPORTS.items())
)
return render_to_string('courseware/accordion.html', context)
def save_child_position(seq_block, child_name):
"""
child_name: url_name of the child

View File

@@ -1,94 +0,0 @@
<%page expression_filter="h"/>
<%namespace name='static' file='../static_content.html'/>
<%!
from django.urls import reverse
from django.utils.translation import gettext as _
from django.conf import settings
from openedx.core.djangolib.markup import HTML, Text
%>
<%def name="make_chapter(chapter)">
<%
if chapter.get('active'):
aria_label = _('{chapter} current chapter').format(chapter=chapter['display_name'])
active_class = 'active'
else:
aria_label = chapter['display_name']
active_class = ''
%>
<a href="#${chapter['display_id']}-child" role="button" class="button-chapter chapter ${active_class}" id="${chapter['display_id']}-parent" aria-controls="${chapter['display_id']}-child" aria-expanded="false">
<span class="group-heading ${active_class}" aria-label="${aria_label}">
<span class="icon fa fa-caret-right" aria-hidden="true"></span>
${HTML(chapter['display_name'])}
</span>
</a>
<div class="chapter-content-container" id="${chapter['display_id']}-child" tabindex="-1" role="region" aria-label="${chapter['display_name']} submenu">
<div class="chapter-menu">
% for section in chapter['sections']:
<div class="menu-item ${'active' if 'active' in section and section['active'] else ''} ${'graded' if 'graded' in section and section['graded'] else ''}">
<a class="accordion-nav" href="${reverse('courseware_section', args=[course_id, chapter['url_name'], section['url_name']])}">
<p class="accordion-display-name">${HTML(section['display_name'])} ${Text(_('{span_start}current section{span_end}')).format(
span_start=HTML('<span class="sr">'),
span_end=HTML('</span>'),
) if 'active' in section and section['active'] else ''}</p>
## There are behavior differences between
## rendering of sections which have proctoring/timed examinations
## and those that do not.
##
## Proctoring exposes a exam status message field as well as
## a status icon
<%
if section.get('due') is None:
data_string = section['format']
else:
if 'proctoring' in section:
data_string = _('due {date}')
else:
data_string = _("{section_format} due {{date}}").format(section_format=section['format'])
%>
% if section['format'] or due_date or 'proctoring' in section:
<p class="subtitle">
% if 'proctoring' in section:
## Display the proctored exam status icon and status message
<span class="menu-icon icon fa ${section['proctoring'].get('suggested_icon', 'fa-pencil-square-o')} ${section['proctoring'].get('status', 'eligible')}" aria-hidden="true"></span>
<span class="subtitle-name">${section['proctoring'].get('short_description', '')}</span>
## completed proctored exam statuses should not show the due date
## since the exam has already been submitted by the user
% if not section['proctoring'].get('in_completed_state', False):
<span class="localized-datetime subtitle-name" data-datetime="${section['due']}" data-string="${data_string}" data-timezone="${user_timezone}" data-language="${user_language}"></span>
% endif
% else:
## non-proctored section, we just show the exam format and the due date
## this is the standard case in edx-platform
<span class="localized-datetime subtitle-name" data-datetime="${section['due']}" data-string="${data_string}" data-timezone="${user_timezone}" data-language="${user_language}"></span>
% if 'graded' in section and section['graded']:
<span class="menu-icon icon fa fa-pencil-square-o" aria-hidden="true"></span>
<span class="sr">${_("This content is graded")}</span>
% endif
% endif
</p>
% endif
</a>
</div>
% endfor
</div>
</div>
</%def>
% for chapter in toc:
${make_chapter(chapter)}
% endfor
% if toc:
<%static:require_module_async module_name="js/courseware/accordion_events" class_name="AccordionEvents">
AccordionEvents();
</%static:require_module_async>
<%static:require_module_async module_name="js/dateutil_factory" class_name="DateUtilFactory">
DateUtilFactory.transform(iterationKey=".localized-datetime");
</%static:require_module_async>
% endif