aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorvincent <vincent@deuxfleurs.fr>2022-09-25 15:19:38 +0200
committervincent <vincent@deuxfleurs.fr>2022-09-25 16:31:57 +0200
commitf8b5a2e1baaac3dd384d9a7039c5adaf8e7b194e (patch)
tree89bd8259c9075f747da51addebf26d6e69536df3 /templates
parentdfa89254a9390e88394985f134e8badd1417f573 (diff)
downloadguide.deuxfleurs.fr-f8b5a2e1baaac3dd384d9a7039c5adaf8e7b194e.tar.gz
guide.deuxfleurs.fr-f8b5a2e1baaac3dd384d9a7039c5adaf8e7b194e.zip
Gestion des poids propres
Diffstat (limited to 'templates')
-rw-r--r--templates/_nav.html100
1 files changed, 70 insertions, 30 deletions
diff --git a/templates/_nav.html b/templates/_nav.html
index e353681..1188b5d 100644
--- a/templates/_nav.html
+++ b/templates/_nav.html
@@ -3,47 +3,87 @@
{% set sec = get_section(path=sec) %}
{% set maxlevel = hierarchy | length %}
+ {# Ici on regarde si toutes les sous-sections et pages contenues ont #}
+ {# une variable weight_custom #}
+ {% set temoin = true %}
+ {% set liste = [] %}
{% if sec.subsections %}
{% for s in sec.subsections %}
- {% set p = get_section(path=s) %}
- <div class="toc-item">
- {% if p.subsections or p.pages %}
- {% if p.path == current.path %}
- <a class="subtext" href="{{ p.permalink | safe}}">‣ <b>{{ p.title }}</b></a>
- {% elif hierarchy is containing(s) %}
- <a class="subtext" href="{{ p.permalink | safe}}">‣ {{ p.title }}</a>
+ {% set s_temp = get_section(path=s) %}
+ {% if not s_temp.extra.weight_custom %}
+ {% set_global temoin = false %}
+ {% else %}
+ {% set_global liste = liste | concat(with=s_temp) %}
+ {% endif %}
+ {% endfor %}
+ {% endif %}
+ {% if sec.pages %}
+ {% for p in sec.pages %}
+ {% if not p.extra.weight_custom %}
+ {% set_global temoin = false %}
+ {% else %}
+ {% set_global liste = liste | concat(with=p) %}
+ {% endif %}
+ {% endfor %}
+ {% endif %}
+
+ {# Si toutes les sous-sections et pages ont une variable weight_custom, #}
+ {# on classe selon elle. Sinon, on utilise la méthode classique. #}
+ {% if temoin %}
+ // classer ici
+
+
+
+
+
+
+
+
+
+
+ {% else %}
+ {% if sec.subsections %}
+ {% for s in sec.subsections %}
+ {% set p = get_section(path=s) %}
+ <div class="toc-item">
+ {% if p.subsections or p.pages %}
+ {% if p.path == current.path %}
+ <a class="subtext" href="{{ p.permalink | safe}}">‣ <b>{{ p.title }}</b></a>
+ {% elif hierarchy is containing(s) %}
+ <a class="subtext" href="{{ p.permalink | safe}}">‣ {{ p.title }}</a>
+ {% else %}
+ <a class="subtext" href="{{ p.permalink | safe}}">‣ {{ p.title }}</a>
+ {% endif %}
+ {% if hierarchy is containing(s) or current.path == p.path %}
+ {% if level + 1 < maxlevel %}
+ <div class="nav-subsection">
+ {{ nav::navsection(hierarchy=hierarchy,level=level + 1,current=current) }}
+ </div>
+ {% endif %}
+ {% endif %}
{% else %}
- <a class="subtext" href="{{ p.permalink | safe}}">‣ {{ p.title }}</a>
- {% endif %}
- {% if hierarchy is containing(s) or current.path == p.path %}
- {% if level + 1 < maxlevel %}
- <div class="nav-subsection">
- {{ nav::navsection(hierarchy=hierarchy,level=level + 1,current=current) }}
- </div>
+ {% if p.path == current.path %}
+ <a class="subtext" href="{{p.permalink | safe}}"><b>{{ p.title }}</b></a>
+ {% else %}
+ <a class="subtext" href="{{p.permalink | safe}}">{{ p.title }}</a>
{% endif %}
{% endif %}
- {% else %}
+ </div>
+ {% endfor %}
+ {% endif %}
+
+ {% if sec.pages %}
+ {% for p in sec.pages %}
+ <div class="toc-item">
{% if p.path == current.path %}
<a class="subtext" href="{{p.permalink | safe}}"><b>{{ p.title }}</b></a>
{% else %}
<a class="subtext" href="{{p.permalink | safe}}">{{ p.title }}</a>
{% endif %}
- {% endif %}
- </div>
+ </div>
{% endfor %}
- {% endif %}
-
- {% if sec.pages %}
- {% for p in sec.pages %}
- <div class="toc-item">
- {% if p.path == current.path %}
- <a class="subtext" href="{{p.permalink | safe}}"><b>{{ p.title }}</b></a>
- {% else %}
- <a class="subtext" href="{{p.permalink | safe}}">{{ p.title }}</a>
- {% endif %}
- </div>
- {% endfor %}
- {% endif %}
+ {% endif %}
+ {% endif %}
{% endmacro navsection %}
{% macro navmenu(current) %}