Skip to content

Commit ef6cc7e

Browse files
Replace tree_node.html include with inline Django 6.0 partialdef (#386)
1 parent 228b72f commit ef6cc7e

2 files changed

Lines changed: 24 additions & 21 deletions

File tree

moderation/templates/moderation/tree.html

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,29 @@
33
{% block title %}Arbre de modération{% endblock %}
44

55
{% block content %}
6+
{% partialdef tree_node %}
7+
<li class="py-1">
8+
<div class="d-flex flex-wrap align-items-baseline gap-1">
9+
{% if not is_root %}
10+
<span class="border-top flex-shrink-0 align-self-center" style="width: 1rem;"></span>
11+
{% endif %}
12+
<strong><a href="{% url 'moderation_profile' node.user.netid %}">{{ node.user.netid }}</a></strong>
13+
<span class="text-muted">{{ node.user.name }}</span>
14+
<span class="text-muted small">({{ node.user.action_count }} action{{ node.user.action_count|pluralize }} de modération, {{ node.user.document_count }} document{{ node.user.document_count|pluralize }})</span>
15+
{% if node.user.is_staff %}
16+
<span class="badge text-bg-danger ms-1">Admin</span>
17+
{% endif %}
18+
</div>
19+
{% if node.children %}
20+
<ul class="list-unstyled border-start ps-0 ms-2 mb-0">
21+
{% for child in node.children %}
22+
{% with node=child is_root=False %}{% partial tree_node %}{% endwith %}
23+
{% endfor %}
24+
</ul>
25+
{% endif %}
26+
</li>
27+
{% endpartialdef tree_node %}
28+
629
<div class="container-xl mt-4">
730
<nav aria-label="breadcrumb">
831
<ol class="breadcrumb">
@@ -21,7 +44,7 @@ <h1 class="h3 mb-4">Arbre de modération</h1>
2144
<div>
2245
<ul class="list-unstyled ps-0 mb-0">
2346
{% for root in tree %}
24-
{% include "moderation/tree_node.html" with node=root is_root=True %}
47+
{% with node=root is_root=True %}{% partial tree_node %}{% endwith %}
2548
{% endfor %}
2649
</ul>
2750
</div>

moderation/templates/moderation/tree_node.html

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)