diff options
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> |
