Unverified Commit 131b14b1 by Simon Chen Committed by GitHub

Merge pull request #16961 from edx/schen/EDUCATOR-1549

Programmatically indicate nested discussions in filter
parents e063a8bd 3de6e778
...@@ -5,37 +5,47 @@ from lms.djangoapps.django_comment_client.constants import TYPE_ENTRY ...@@ -5,37 +5,47 @@ from lms.djangoapps.django_comment_client.constants import TYPE_ENTRY
from openedx.core.djangolib.markup import HTML from openedx.core.djangolib.markup import HTML
%> %>
<%def name="render_dropdown(map)"> <%def name="render_dropdown(map, topic_list)">
% for child, c_type in map["children"]: % for child, c_type in map["children"]:
% if child in map["entries"] and c_type == TYPE_ENTRY: % if child in map["entries"] and c_type == TYPE_ENTRY:
${HTML(render_entry(map["entries"], child))} ${HTML(render_entry(map["entries"], child, topic_list))}
%else: %else:
${HTML(render_category(map["subcategories"], child))} ${HTML(render_category(map["subcategories"], child, topic_list))}
%endif %endif
%endfor %endfor
</%def> </%def>
<%def name="render_entry(entries, entry)"> <%def name="render_entry(entries, entry, topic_list)">
<li <li
class="forum-nav-browse-menu-item" class="forum-nav-browse-menu-item"
data-discussion-id='${entries[entry]["id"]}' data-discussion-id='${entries[entry]["id"]}'
id='${entries[entry]["id"]}' id='${entries[entry]["id"]}'
data-divided="${str(entries[entry]['is_divided']).lower()}" data-divided="${str(entries[entry]['is_divided']).lower()}"
role="option" role="presentation"
> >
% if entry: %if entry:
<span class="forum-nav-browse-title">${entry}</span> <span class="forum-nav-browse-title" role="option">
%if topic_list:
<span class="sr">
${', '.join(topic_list)},
</span>
%endif
${entry}
</span>
%endif %endif
</li> </li>
</%def> </%def>
<%def name="render_category(categories, category)"> <%def name="render_category(categories, category, topic_list)">
<li class="forum-nav-browse-menu-item" <li class="forum-nav-browse-menu-item"
id='${category | u}' id='${category | u}'
role="presentation"
> >
<span class="forum-nav-browse-title">${category}</span> <span class="forum-nav-browse-title" role="option">${category}</span>
<ul class="forum-nav-browse-submenu"> <ul class="forum-nav-browse-submenu" role="presentation">
${HTML(render_dropdown(categories[category]))} <% topic_list.append(category) %>
${HTML(render_dropdown(categories[category], topic_list))}
<% topic_list.remove(category) %>
</ul> </ul>
</li> </li>
</%def> </%def>
...@@ -49,13 +59,13 @@ from openedx.core.djangolib.markup import HTML ...@@ -49,13 +59,13 @@ from openedx.core.djangolib.markup import HTML
</label> </label>
</form> </form>
<ul class="forum-nav-browse-menu" role="listbox" id="discussion_topics_listbox"> <ul class="forum-nav-browse-menu" role="listbox" id="discussion_topics_listbox">
<li class="forum-nav-browse-menu-item forum-nav-browse-menu-all" role="option" id="all_discussions"> <li class="forum-nav-browse-menu-item forum-nav-browse-menu-all" role="presentation" id="all_discussions">
<span class="forum-nav-browse-title">${_("All Discussions")}</span> <span class="forum-nav-browse-title" role="option">${_("All Discussions")}</span>
</li> </li>
<li class="forum-nav-browse-menu-item forum-nav-browse-menu-following" role="option" id="posts_following"> <li class="forum-nav-browse-menu-item forum-nav-browse-menu-following" role="presentation" id="posts_following">
<span class="icon fa fa-star" aria-hidden="true"></span> <span class="icon fa fa-star" aria-hidden="true"></span>
<span class="forum-nav-browse-title">${_("Posts I'm Following")}</span> <span class="forum-nav-browse-title" role="option">${_("Posts I'm Following")}</span>
</li> </li>
${HTML(render_dropdown(category_map))} ${HTML(render_dropdown(category_map, []))}
</ul> </ul>
</div> </div>
Markdown is supported
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