]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/2837'
authorTom Hughes <tom@compton.nu>
Wed, 16 Sep 2020 15:35:55 +0000 (16:35 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 16 Sep 2020 15:35:55 +0000 (16:35 +0100)
app/views/browse/_node.html.erb
app/views/browse/_relation.html.erb
app/views/browse/_way.html.erb
config/locales/en.yml

index 6acc5e01ed9e5f0e5cbc99fe7dc7bb1002cd8adb..ab91a9728a6f8fd288de91f0608f00feae265638 100644 (file)
 
     <% 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 %>
index b54581b8bda2e34f0bcf480cd6683112b99f418a..1dc78afba4dd8d2d17ef2db4e39d793a9db039bc 100644 (file)
 
     <% 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 %>
index 137d529ff2a1296831a1c44d0c0be00d1dbd8cb6..2788fdea920111c871d7a336a4c4cf475632bab7 100644 (file)
 
     <% 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 %>
index 997500b3d8ab36734e3f66b7b291044f0768c4cf..ec08012fe2d4a8acd4f5471f1db1aef6dd369cc5 100644 (file)
@@ -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"
@@ -265,6 +271,8 @@ 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}"
@@ -272,6 +280,9 @@ en:
       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}"