en/templates/tree.html
2025-12-20 21:28:00 -03:00

90 lines
2.9 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_text %}
<ul>
{% if config.tree_node_text %}
<li><strong>Text:</strong>
<ul style="display: inline; padding-left: 0;">
<li style="display: inline;">
<details style="display: inline; cursor: pointer;">
<summary style="display: inline;">
{{root_node.text | truncate(length=120)}}
</summary>
{{root_node.text}}
</details>
</li>
</ul>
{% endif %}
{% if root_node.connections %}
{% if config.tree_node_text %}<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_text %}</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_text %}
<ul>
{% if config.tree_node_text %}
<li><strong>Text:</strong>
<ul style="display: inline; padding-left: 0;">
<li style="display: inline;">
<details style="display: inline; cursor: pointer;">
<summary style="display: inline;">
{{node.text | truncate(length=30)}}
</summary>
{{node.text}}
</details>
</li>
</ul>
{% endif %}
{% if node.connections %}
{% if config.tree_node_text %}<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_text %}</ul>
</li>{% endif %}
{% endif %}
</ul>
{% endif %}
</li>
{% endfor %}
{% endif %}
</ul>
{% else %}
{% include "empty.html" %}
{% endif %}
{%- endblock body %}