Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/pull/2837'
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Sep 16, 2020
2 parents f70ec18 + b4b59df commit 633445b
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 22 deletions.
24 changes: 18 additions & 6 deletions app/views/browse/_node.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,24 @@
<% unless node.ways.empty? and node.containing_relation_members.empty? %>
<h4><%= t "browse.part_of" %></h4>
<ul class="list-unstyled">
<% node.ways.uniq.each do |way| %>
<li><%= link_to printable_name(way), { :action => "way", :id => way.id.to_s }, { :class => link_class("way", way), :title => link_title(way) } %></li>
<% end %>
<%= render :partial => "containing_relation", :collection => node.containing_relation_members.uniq %>
</ul>
<% unless node.ways.empty? %>
<details <%= 'open' if node.ways.count < 10 %>>
<summary><%= t 'browse.part_of_ways', :count => node.ways.count %></summary>
<ul class="list-unstyled">
<% node.ways.uniq.each do |way| %>
<li><%= link_to printable_name(way), { :action => "way", :id => way.id.to_s }, { :class => link_class("way", way), :title => link_title(way) } %></li>
<% end %>
</ul>
</details>
<% end %>
<% unless node.containing_relation_members.empty? %>
<details <%= 'open' if node.containing_relation_members.count < 10 %>>
<summary><%= t 'browse.part_of_relations', :count => node.containing_relation_members.count %></summary>
<ul class="list-unstyled">
<%= render :partial => "containing_relation", :collection => node.containing_relation_members.uniq %>
</ul>
</details>
<% end %>
<% end %>
</div>
<% end %>
14 changes: 12 additions & 2 deletions app/views/browse/_relation.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,22 @@
<% unless relation.containing_relation_members.empty? %>
<h4><%= t "browse.part_of" %></h4>
<ul class="list-unstyled"><%= render :partial => "containing_relation", :collection => relation.containing_relation_members.uniq %></ul>
<details <%= 'open' if relation.containing_relation_members.count < 10 %>>
<summary><%= t 'browse.part_of_relations', :count => relation.containing_relation_members.count %></summary>
<ul class="list-unstyled">
<%= render :partial => "containing_relation", :collection => relation.containing_relation_members.uniq %>
</ul>
</details>
<% end %>
<% unless relation.relation_members.empty? %>
<h4><%= t ".members" %></h4>
<ul class="list-unstyled"><%= render :partial => "relation_member", :collection => relation.relation_members %></ul>
<details <%= 'open' if relation.relation_members.count < 10 %>>
<summary><%= t '.members_count', :count => relation.relation_members.count %></summary>
<ul class="list-unstyled">
<%= render :partial => "relation_member", :collection => relation.relation_members %>
</ul>
</details>
<% end %>
</div>
<% end %>
34 changes: 20 additions & 14 deletions app/views/browse/_way.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,30 @@
<% unless way.containing_relation_members.empty? %>
<h4><%= t "browse.part_of" %></h4>
<ul class="list-unstyled">
<%= render :partial => "containing_relation", :collection => way.containing_relation_members.uniq %>
</ul>
<details <%= 'open' if way.containing_relation_members.count < 10 %>>
<summary><%= t 'browse.part_of_relations', :count => way.containing_relation_members.count %></summary>
<ul class="list-unstyled">
<%= render :partial => "containing_relation", :collection => way.containing_relation_members.uniq %>
</ul>
</details>
<% end %>
<% unless way.way_nodes.empty? %>
<h4><%= t ".nodes" %></h4>
<ul class="list-unstyled">
<% way.way_nodes.each do |wn| %>
<li>
<%= link_to printable_name(wn.node), { :action => "node", :id => wn.node_id.to_s }, { :class => link_class("node", wn.node), :title => link_title(wn.node), :rel => link_follow(wn.node) } %>
<% related_ways = wn.node.ways.reject { |w| w.id == wn.way_id } %>
<% if related_ways.size > 0 then %>
(<%= t ".also_part_of_html", :count => related_ways.size, :related_ways => to_sentence(related_ways.map { |w| link_to(printable_name(w), { :action => "way", :id => w.id.to_s }, { :class => link_class("way", w), :title => link_title(w) }) }) %>)
<% end %>
</li>
<% end %>
</ul>
<details <%= 'open' if way.way_nodes.count < 10 %>>
<summary><%= t '.nodes_count', :count => way.way_nodes.count %></summary>
<ul class="list-unstyled">
<% way.way_nodes.each do |wn| %>
<li>
<%= link_to printable_name(wn.node), { :action => "node", :id => wn.node_id.to_s }, { :class => link_class("node", wn.node), :title => link_title(wn.node), :rel => link_follow(wn.node) } %>
<% related_ways = wn.node.ways.reject { |w| w.id == wn.way_id } %>
<% if related_ways.size > 0 then %>
(<%= t ".also_part_of_html", :count => related_ways.size, :related_ways => to_sentence(related_ways.map { |w| link_to(printable_name(w), { :action => "way", :id => w.id.to_s }, { :class => link_class("way", w), :title => link_title(w) }) }) %>)
<% end %>
</li>
<% end %>
</ul>
</details>
<% end %>
</div>
<% end %>
11 changes: 11 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ en:
anonymous: "anonymous"
no_comment: "(no comment)"
part_of: "Part of"
part_of_relations:
one: 1 relation
other: "%{count} relations"
part_of_ways:
one: 1 way
other: "%{count} ways"
download_xml: "Download XML"
view_history: "View History"
view_details: "View Details"
Expand Down Expand Up @@ -265,13 +271,18 @@ en:
title_html: "Way: %{name}"
history_title_html: "Way History: %{name}"
nodes: "Nodes"
nodes_count:
other: "%{count} nodes"
also_part_of_html:
one: "part of way %{related_ways}"
other: "part of ways %{related_ways}"
relation:
title_html: "Relation: %{name}"
history_title_html: "Relation History: %{name}"
members: "Members"
members_count:
one: 1 member
other: "%{count} members"
relation_member:
entry_html: "%{type} %{name}"
entry_role_html: "%{type} %{name} as %{role}"
Expand Down

0 comments on commit 633445b

Please sign in to comment.