diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-08-06 21:15:03 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-08-06 21:15:03 +0200 |
| commit | 0f8a3066c55b6ecb9d95b3e9306eee5262928b14 (patch) | |
| tree | 47dea8952fd458e0c100682b26c9a50c6f6ee293 /app/views/nodes/sitemap.html.erb | |
| parent | 5644fffbc3c58e6dd7e3c4103c28bad8f4c0bbc6 (diff) | |
Re-structure sitemap, all subpages collapsed by default, visually tightened
Diffstat (limited to 'app/views/nodes/sitemap.html.erb')
| -rw-r--r-- | app/views/nodes/sitemap.html.erb | 24 |
1 files changed, 17 insertions, 7 deletions
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 @@ | |||
| 15 | 15 | ||
| 16 | <% @sitemap.each_with_index do |(node, level), index| %> | 16 | <% @sitemap.each_with_index do |(node, level), index| %> |
| 17 | <% while open_details.any? && open_details.last >= level %> | 17 | <% while open_details.any? && open_details.last >= level %> |
| 18 | </details> | 18 | <% closing = open_details.pop %> |
| 19 | <% open_details.pop %> | 19 | <% if closing.zero? %></div><% else %></details><% end %> |
| 20 | <% end %> | 20 | <% end %> |
| 21 | 21 | ||
| 22 | <% unless level.zero? %> | 22 | <% unless level.zero? %> |
| @@ -52,12 +52,22 @@ | |||
| 52 | 52 | ||
| 53 | <% next_level = @sitemap[index + 1]&.last %> | 53 | <% next_level = @sitemap[index + 1]&.last %> |
| 54 | <% if next_level && next_level > level %> | 54 | <% if next_level && next_level > level %> |
| 55 | <details<%= ' open' if sitemap_node_open?(node) %>> | 55 | <% if level.zero? %> |
| 56 | <summary> | 56 | <%# Root's children are the top level: a tree does not hide its own |
| 57 | <%= t(".descendants", :count => @sitemap_descendant_counts[node.id]) %> | 57 | first rank behind a toggle. A plain div keeps the closing-tag |
| 58 | </summary> | 58 | bookkeeping symmetric with the details branches. %> |
| 59 | <div class="sitemap_children"> | ||
| 60 | <% else %> | ||
| 61 | <details> | ||
| 62 | <summary> | ||
| 63 | <%= t(".descendants", :count => @sitemap_descendant_counts[node.id]) %> | ||
| 64 | </summary> | ||
| 65 | <% end %> | ||
| 59 | <% open_details.push(level) %> | 66 | <% open_details.push(level) %> |
| 60 | <% end %> | 67 | <% end %> |
| 61 | <% end %> | 68 | <% end %> |
| 62 | <% open_details.length.times { %></details><% } %> | 69 | <% while open_details.any? %> |
| 70 | <% closing = open_details.pop %> | ||
| 71 | <% if closing.zero? %></div><% else %></details><% end %> | ||
| 72 | <% end %> | ||
| 63 | </div> | 73 | </div> |
