en/templates/tree.html

74 lines
2.3 KiB
HTML

{% extends "base.html" %}
{% block title %}Tree{% endblock title %}
<!-- TODO Tera has macros, which could considerably simplify this template -->
<!-- See: https://keats.github.io/tera/docs/#macros -->
{%- block body %}
{% if nodes or root_node %}
<h1>Tree</h1>
<p><strong>Total nodes:</strong> {{ nodes | length }}</p>
{% if root_node %}
<h2>Root node</h2>
<ul>
<li>
<a href="/node/{{root_node.id}}">{{root_node.title}}</a>
{% if root_node.connections or config.tree_node_summary %}
<ul>
{% if config.tree_node_summary %}
<li class="tree-node-summary">
{{ root_node.summary }}
</li>
{% endif %}
{% if root_node.connections %}
{% if config.tree_node_summary %}<li><strong>Connections</strong>
<ul>{% endif %}
{% for _, connection in root_node.connections %}
<li><a href="/node/{{connection.to}}">{{connection.to}}</a></li>
{% endfor %}
{% if config.tree_node_summary %}</ul>
</li>{% endif %}
{% endif %}
</ul>
{% endif %}
</li>
</ul>
{% endif %}
{% if nodes %}
<h2>All nodes</h2>
<ul>
{% for node in nodes | filter(attribute="hidden", value=false)%}
<li>
<a href="/node/{{node.id}}">{{node.title}}</a>
{% if node.connections or config.tree_node_summary %}
<ul>
{% if config.tree_node_summary %}
<li class="tree-node-summary">
{{node.summary}}
</li>
{% endif %}
{% if node.connections %}
{% if config.tree_node_summary %}<li><strong>Connections</strong>
<ul>{% endif %}
{% for _, connection in node.connections %}
{% if not connection.detached %}
<li><a href="/node/{{connection.to}}">{{connection.to}}</a></li>
{% endif %}
{% endfor %}
{% if config.tree_node_summary %}</ul>
</li>{% endif %}
{% endif %}
</ul>
{% endif %}
</li>
{% endfor %}
{% endif %}
</ul>
{% else %}
{% include "empty.html" %}
{% endif %}
{%- endblock body %}