From 0f8a3066c55b6ecb9d95b3e9306eee5262928b14 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Thu, 6 Aug 2026 21:15:03 +0200 Subject: Re-structure sitemap, all subpages collapsed by default, visually tightened --- app/views/nodes/sitemap.html.erb | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'app/views') diff --git a/app/views/nodes/sitemap.html.erb b/app/views/nodes/sitemap.html.erb index 49a59d4c..3b9328da 100644 --- a/app/views/nodes/sitemap.html.erb +++ b/app/views/nodes/sitemap.html.erb @@ -15,8 +15,8 @@ <% @sitemap.each_with_index do |(node, level), index| %> <% while open_details.any? && open_details.last >= level %> - - <% open_details.pop %> + <% closing = open_details.pop %> + <% if closing.zero? %><% else %><% end %> <% end %> <% unless level.zero? %> @@ -52,12 +52,22 @@ <% next_level = @sitemap[index + 1]&.last %> <% if next_level && next_level > level %> - > - - <%= t(".descendants", :count => @sitemap_descendant_counts[node.id]) %> - + <% if level.zero? %> + <%# Root's children are the top level: a tree does not hide its own + first rank behind a toggle. A plain div keeps the closing-tag + bookkeeping symmetric with the details branches. %> +
+ <% else %> +
+ + <%= t(".descendants", :count => @sitemap_descendant_counts[node.id]) %> + + <% end %> <% open_details.push(level) %> <% end %> <% end %> -<% open_details.length.times { %>
<% } %> +<% while open_details.any? %> + <% closing = open_details.pop %> + <% if closing.zero? %>
<% else %><% end %> +<% end %> -- cgit v1.3