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/helpers/nodes_helper.rb | 4 ---- app/views/nodes/sitemap.html.erb | 24 +++++++++++++++++------- 2 files changed, 17 insertions(+), 11 deletions(-) (limited to 'app') diff --git a/app/helpers/nodes_helper.rb b/app/helpers/nodes_helper.rb index 48f44f8b..fa3cc443 100644 --- a/app/helpers/nodes_helper.rb +++ b/app/helpers/nodes_helper.rb @@ -70,8 +70,4 @@ module NodesHelper path = node.unique_path CccConventions::NODE_KINDS.select { |_, config| config[:parent_match]&.call(path) } end - - def sitemap_node_open?(node) - !CccConventions::SITEMAP_COLLAPSED_PATHS.include?(node.unique_name) - end end 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