Browse Source

Add subgroups list in group sidebar (fixes #567)

merge-requests/82/head
deing 6 years ago
parent
commit
ad4859dac1
No known key found for this signature in database GPG Key ID: DA34C790D267C164
  1. 11
      tildes/tildes/templates/topic_listing.jinja2
  2. 8
      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>

8
tildes/tildes/views/topic.py

@ -157,10 +157,17 @@ 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 = [
group
for group in request.query(Group).all()
if group.is_subgroup_of(request.context)
]
default_settings = _get_default_settings(request, order) default_settings = _get_default_settings(request, order)
if order is missing: if order is missing:
@ -245,6 +252,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