diff --git a/src/handlers/graph.rs b/src/handlers/graph.rs index 2066e73..321a43e 100644 --- a/src/handlers/graph.rs +++ b/src/handlers/graph.rs @@ -9,15 +9,11 @@ pub async fn node(Path(id): Path) -> Response { let node: &Node = graph.nodes.get(&id).unwrap_or(&empty_node); let mut context = tera::Context::new(); - context.insert("id", &id); - context.insert("title", &node.title); - context.insert("connections", &node.connections.clone()); + context.insert("node", &node); + context.insert("text", &content::parse(&node.text)); context.insert("incoming", &graph.incoming.get(&id)); context.insert("config", &graph.meta.config.parse_text()); - let out_text = content::parse(&node.text); - context.insert("text", &out_text); - let not_found = *node == empty_node; let template_name = "node.html".to_string(); diff --git a/templates/node.html b/templates/node.html index 6a6e39a..e149e6c 100644 --- a/templates/node.html +++ b/templates/node.html @@ -1,30 +1,35 @@ {% extends "base.html" %} -{% block title %}{{ title }}{% endblock title %} +{% block title %}{{ node.title }}{% endblock title %} {%- block body %}
-

{{ title }}

- ID: {{ id }} +
+

{{ node.title }}

+
+ ID: {{ node.id }} + {% if node.hidden %}Hidden{% endif %} +
+
{{ text | safe }}
- {% if connections or incoming %} + {% if node.connections or incoming %}