]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/4583'
authorTom Hughes <tom@compton.nu>
Sat, 16 Mar 2024 11:34:17 +0000 (11:34 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 16 Mar 2024 11:34:17 +0000 (11:34 +0000)
app/helpers/browse_helper.rb
app/views/browse/_node.html.erb
app/views/browse/_way.html.erb
test/controllers/nodes_controller_test.rb
test/controllers/relations_controller_test.rb
test/controllers/ways_controller_test.rb

index 53e980fdceb8d090a22378fea2f3815e6954421a..d3e8f10f900174119adf34a9b023774fe734c4dc 100644 (file)
@@ -1,6 +1,6 @@
 module BrowseHelper
-  def element_single_current_link(type, object, url)
-    link_to url, { :class => element_class(type, object), :title => element_title(object), :rel => (link_follow(object) if type == "node") } do
+  def element_single_current_link(type, object)
+    link_to object, { :class => element_class(type, object), :title => element_title(object), :rel => (link_follow(object) if type == "node") } do
       element_strikethrough object do
         printable_element_name object
       end
index e395a4283832c99054de1f2829f37ed025795218..4e2ae0343d2e57f5ba7a460b5701892ed0d923b3 100644 (file)
@@ -17,7 +17,7 @@
           <summary><%= t "browse.part_of_ways", :count => node.ways.uniq.count %></summary>
           <ul class="list-unstyled">
             <% node.ways.uniq.each do |way| %>
-              <li><%= element_single_current_link "way", way, way_path(way) %></li>
+              <li><%= element_single_current_link "way", way %></li>
             <% end %>
           </ul>
         </details>
index 19c5ff59087f86e4a9f5f4b52ecdbfdcc51a4202..d015438fe998568ae45c1a454ff63f8e6ef0b2d7 100644 (file)
         <ul class="list-unstyled">
           <% way.way_nodes.each do |wn| %>
             <li>
-              <%= element_single_current_link "node", wn.node, node_path(wn.node) %>
+              <%= element_single_current_link "node", 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| element_single_current_link "way", w, way_path(w) }) %>)
+                       :related_ways => to_sentence(related_ways.map { |w| element_single_current_link "way", w }) %>)
               <% end %>
             </li>
           <% end %>
index cd1b61f52d347ddeeccab66baf2335ab6e25a111..5bb08ea7104ba3ad21e531e1a9901ccb8a47a2ed 100644 (file)
@@ -29,6 +29,14 @@ class NodesControllerTest < ActionDispatch::IntegrationTest
     assert_select ".secondary-actions a[href='#{old_node_path node, 2}']", :count => 1
   end
 
+  def test_show_relation_member
+    member = create(:node)
+    relation = create(:relation)
+    create(:relation_member, :relation => relation, :member => member)
+    sidebar_browse_check :node_path, member.id, "browse/feature"
+    assert_select "a[href='#{relation_path relation}']", :count => 1
+  end
+
   def test_show_deleted
     node = create(:node, :visible => false)
     sidebar_browse_check :node_path, node.id, "browse/feature"
index cbaa51c05b8d58d40b2b786f6b92d1c894f8d158..926d9502638c1650b46ae44182e6e723b045e933 100644 (file)
@@ -28,4 +28,12 @@ class RelationsControllerTest < ActionDispatch::IntegrationTest
     assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_relation_path relation, 2}']", :count => 1
   end
+
+  def test_show_relation_member
+    member = create(:relation)
+    relation = create(:relation)
+    create(:relation_member, :relation => relation, :member => member)
+    sidebar_browse_check :relation_path, member.id, "browse/feature"
+    assert_select "a[href='#{relation_path relation}']", :count => 1
+  end
 end
index 6c3c5a8a33c39eae1a0f5b37a5bad10e8b566217..e198f7cf6091f08af424b110955c86e6420d1739 100644 (file)
@@ -28,4 +28,12 @@ class WaysControllerTest < ActionDispatch::IntegrationTest
     assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_way_path way, 2}']", :count => 1
   end
+
+  def test_show_relation_member
+    member = create(:way)
+    relation = create(:relation)
+    create(:relation_member, :relation => relation, :member => member)
+    sidebar_browse_check :way_path, member.id, "browse/feature"
+    assert_select "a[href='#{relation_path relation}']", :count => 1
+  end
 end