ckanext-d4science_theme/ckanext/d4science_theme/templates/group/snippets/group_tree.html

33 lines
953 B
HTML

{#
Displays a tree of organzations
NB This template can be slow because it is recursive and uses link_for. At
DGU we speeded up display of the tree 10 times (necessary as we have 1000
organizations) by replacing this template with a recursive code routine:
https://github.com/datagovuk/ckanext-dgu/blob/5fb78b354517c2198245bdc9c98fb5d6c82c6bcc/ckanext/dgu/lib/helpers.py#L140
orgs - List of organizations
Example:
{% snippet 'group/snippets/group_tree.html', top_nodes=h.get_action('group_tree', {'type': 'group'}) %}
#}
<ul>
{% for node in top_nodes recursive %}
<li id="node_{{ node.name }}">
{% if node.highlighted %}
<strong>
{% endif %}
{% link_for node.title, controller='group', action='read', id=node.name %}
{% if node.highlighted %}
</strong>
{% endif %}
{% if node.children %}
<ul> {{ loop(node.children) }} </ul>
{% endif %}
</li>
{% endfor %}
</ul>