Skip to content

Commit

Permalink
Put nested "also..." lists into collapsible details
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKhorev committed Dec 6, 2024
1 parent 6aab004 commit f581934
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions app/views/browse/_way.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<details <%= "open" if way.way_nodes.count < 10 %>>
<summary><%= t ".nodes_count", :count => way.way_nodes.count %></summary>
<ul class="list-unstyled">
<% visited_way_nodes = {} %>
<% way.way_nodes.each do |wn| %>
<li>
<% related_ways = wn.node.ways.uniq.sort.reject { |w| w.id == wn.way_id } %>
Expand All @@ -34,17 +35,18 @@
<div>
<%= element_single_current_link "node", wn.node %>
</div>
<div class="ms-4">
<%= t ".also_part_of_ways", :count => related_ways.size %>
<%= tag.details :class => "ms-4", :open => !visited_way_nodes[wn.node.id] do %>
<summary><%= t ".also_part_of_ways", :count => related_ways.size %></summary>
<ul class="list-unstyled">
<% related_ways.each do |related_way| %>
<li>
<%= element_single_current_link "way", related_way %>
</li>
<% end %>
</ul>
</div>
<% end %>
<% end %>
<% visited_way_nodes[wn.node.id] = true %>
</li>
<% end %>
</ul>
Expand Down
4 changes: 2 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ en:
one: "%{count} node"
other: "%{count} nodes"
also_part_of_ways:
one: "also part of way:"
other: "also part of ways:"
one: "also part of %{count} other way"
other: "also part of %{count} other ways"
relation:
title_html: "Relation: %{name}"
history_title_html: "Relation History: %{name}"
Expand Down

0 comments on commit f581934

Please sign in to comment.