]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/browse/_way.html.erb
Show linked features as collapsable detail panels on feature browse pages
[rails.git] / app / views / browse / _way.html.erb
index fd419586fb1749c8ba4aae9ac0e0fd963ddf1858..2788fdea920111c871d7a336a4c4cf475632bab7 100644 (file)
@@ -1,35 +1,41 @@
 <% if way.redacted? %>
   <div class='browse-section browse-redacted'>
-    <%= t 'browse.redacted.message_html',
-          :type => t('browse.redacted.type.way'),
+    <%= t "browse.redacted.message_html",
+          :type => t("browse.redacted.type.way"),
           :version => way.version,
-          :redaction_link => link_to(t('browse.redacted.redaction',
+          :redaction_link => link_to(t("browse.redacted.redaction",
                                        :id => way.redaction.id), way.redaction) %>
   </div>
 <% else %>
   <div class='browse-section browse-way'>
     <%= render :partial => "common_details", :object => way %>
 
-    <% unless way.way_nodes.empty? %>
-      <h4><%= t'browse.way.nodes' %></h4>
-      <ul>
-        <% way.way_nodes.each do |wn| %>
-          <li>
-            <%= link_to h(printable_name(wn.node)), { :action => "node", :id => wn.node_id.to_s }, :class => link_class('node', wn.node), :title => link_title(wn.node) %>
-            <% related_ways = wn.node.ways.reject { |w| w.id == wn.way_id } %>
-            <% if related_ways.size > 0 then %>
-              (<%= raw t 'browse.way.also_part_of', :count => related_ways.size, :related_ways => related_ways.map { |w| link_to(h(printable_name(w)), { :action => "way", :id => w.id.to_s }, :class => link_class('way', w), :title => link_title(w) ) }.to_sentence %>)
-            <% end %>
-          </li>
-        <% end %>
-      </ul>
+    <% unless way.containing_relation_members.empty? %>
+      <h4><%= t "browse.part_of" %></h4>
+      <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.containing_relation_members.empty? %>
-      <h4><%= t'browse.part_of' %></h4>
-      <ul>
-        <%= render :partial => "containing_relation", :collection => way.containing_relation_members %>
-      </ul>
+    <% unless way.way_nodes.empty? %>
+      <h4><%= t ".nodes" %></h4>
+      <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 %>