]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/browse/_relation.html.erb
Add block tab to show block pages
[rails.git] / app / views / browse / _relation.html.erb
index e8f9a4f51acd6408c64863907cf9c1773111f1f9..a987fe4d8e179bdedd701197e80e1a8c22a45302 100644 (file)
@@ -1,21 +1,33 @@
-<div class='browse-section'>
-  <% if relation.redacted? %>
-    <%= t 'browse.redacted.message_html',
-          :type => t('browse.redacted.type.relation'),
+<% if relation.redacted? && !params[:show_redactions] %>
+  <div class="browse-section browse-redacted">
+    <%= t "browse.redacted.message_html",
+          :type => t("browse.redacted.type.relation"),
           :version => relation.version,
-          :redaction_link => link_to(t('browse.redacted.redaction',
-                                       :id => relation.redaction.id), relation.redaction) %><
-  <% else %>
-    <%= render :partial => "common_details", :object => relation %>
+          :redaction_link => link_to(t("browse.redacted.redaction",
+                                       :id => relation.redaction.id), relation.redaction) %>
+  </div>
+<% else %>
+  <%= tag.div :class => ["browse-section", "browse-relation", { "text-muted" => relation.redacted? }] do %>
+    <%= render :partial => "browse/common_details", :object => relation %>
 
-    <% unless relation.relation_members.empty? %>
-      <h4><%= t'browse.relation.members' %></h4>
-      <ul><%= render :partial => "relation_member", :collection => relation.relation_members %></ul>
+    <% unless relation.containing_relation_members.empty? %>
+      <h4><%= t "browse.part_of" %></h4>
+      <details <%= "open" if relation.containing_relation_members.count < 10 %>>
+        <summary><%= t "browse.part_of_relations", :count => relation.containing_relation_members.uniq.count %></summary>
+        <ul class="list-unstyled">
+          <%= render :partial => "browse/containing_relation", :collection => relation.containing_relation_members.uniq %>
+        </ul>
+      </details>
     <% end %>
 
-    <% unless relation.containing_relation_members.empty? %>
-      <h4><%= t'browse.part_of' %></h4>
-      <ul><%= render :partial => "containing_relation", :collection => relation.containing_relation_members %></ul>
+    <% unless relation.relation_members.empty? %>
+      <h4><%= t ".members" %></h4>
+      <details <%= "open" if relation.relation_members.count < 10 %>>
+        <summary><%= t ".members_count", :count => relation.relation_members.count %></summary>
+        <ul class="list-unstyled">
+          <%= render :partial => "browse/relation_member", :collection => relation.relation_members %>
+        </ul>
+      </details>
     <% end %>
   <% end %>
-</div>
+<% end %>