Browse Source

Add subgroups list in group sidebar

merge-requests/85/head
deing 5 years ago
committed by Deimos
parent
commit
9bd9e57922
  1. 11
      tildes/tildes/templates/topic_listing.jinja2
  2. 11
      tildes/tildes/views/topic.py

11
tildes/tildes/templates/topic_listing.jinja2

@ -224,6 +224,17 @@
{{ group.sidebar_rendered_html|safe }} {{ group.sidebar_rendered_html|safe }}
{% endif %} {% endif %}
{% if subgroups %}
<ul class="nav">
<li>Subgroups</li>
<ul class="nav">
{% for subgroup in subgroups %}
<li class="nav-item">{{ group_linked(subgroup.path) }}</li>
{% endfor %}
</ul>
</ul>
{% endif %}
{% if wiki_pages or wiki_has_index %} {% if wiki_pages or wiki_has_index %}
<ul class="nav"> <ul class="nav">
<li>Group wiki pages</li> <li>Group wiki pages</li>

11
tildes/tildes/views/topic.py

@ -157,10 +157,20 @@ def get_group_topics(
groups = [ groups = [
group for group in request.query(Group).all() if group.path != "test" group for group in request.query(Group).all() if group.path != "test"
] ]
subgroups = None
else: else:
# otherwise, just topics from the single group that we're looking at # otherwise, just topics from the single group that we're looking at
groups = [request.context] groups = [request.context]
subgroups = (
request.query(Group)
.filter(
Group.path.descendant_of(request.context.path),
Group.path != request.context.path,
)
.all()
)
default_settings = _get_default_settings(request, order) default_settings = _get_default_settings(request, order)
if order is missing: if order is missing:
@ -245,6 +255,7 @@ def get_group_topics(
"unfiltered": unfiltered, "unfiltered": unfiltered,
"wiki_pages": wiki_pages, "wiki_pages": wiki_pages,
"wiki_has_index": wiki_has_index, "wiki_has_index": wiki_has_index,
"subgroups": subgroups,
} }

Loading…
Cancel
Save