]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/browse/_node.html.erb
Show linked features as collapsable detail panels on feature browse pages
[rails.git] / app / views / browse / _node.html.erb
index 581c49b09155b30435a499c9361040cc2b9aafcb..ab91a9728a6f8fd288de91f0608f00feae265638 100644 (file)
@@ -1,9 +1,9 @@
 <% if node.redacted? %>
   <div class='browse-section browse-redacted'>
-    <%= t 'browse.redacted.message_html',
-          :type => t('browse.redacted.type.node'),
+    <%= t "browse.redacted.message_html",
+          :type => t("browse.redacted.type.node"),
           :version => node.version,
-          :redaction_link => link_to(t('browse.redacted.redaction',
+          :redaction_link => link_to(t("browse.redacted.redaction",
                                        :id => node.redaction.id), node.redaction) %>
   </div>
 <% else %>
     <%= render :partial => "common_details", :object => node %>
 
     <% unless node.ways.empty? and node.containing_relation_members.empty? %>
-      <h4><%= t 'browse.part_of' %></h4>
-      <ul>
-        <% node.ways.uniq.each do |way| %>
-          <li><%= link_to h(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>
+      <h4><%= t "browse.part_of" %></h4>
+      <% 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 %>