]> git.openstreetmap.org Git - rails.git/commitdiff
Move changeset element headings to changesets locale
authorAnton Khorev <tony29@yandex.ru>
Thu, 29 Feb 2024 08:02:30 +0000 (11:02 +0300)
committerAnton Khorev <tony29@yandex.ru>
Fri, 1 Mar 2024 07:48:30 +0000 (10:48 +0300)
app/helpers/browse_helper.rb
config/locales/en.yml
test/controllers/changesets_controller_test.rb

index 67b3c7cf77fcdb2ed07b1d23a02babdcf513c47e..53e980fdceb8d090a22378fea2f3815e6954421a 100644 (file)
@@ -72,10 +72,10 @@ module BrowseHelper
 
   def type_and_paginated_count(type, pages)
     if pages.page_count == 1
-      t "browse.changeset.#{type}",
+      t ".#{type.pluralize}",
         :count => pages.item_count
     else
-      t "browse.changeset.#{type}_paginated",
+      t ".#{type.pluralize}_paginated",
         :x => pages.current_page.first_item,
         :y => pages.current_page.last_item,
         :count => pages.item_count
index 616e350d3056a877107d156c5b7eec163cd3ad95..18a10f7af9adb009a6776b27f64cc63cfa367062 100644 (file)
@@ -335,12 +335,6 @@ en:
       coordinates_html: "%{latitude}, %{longitude}"
     changeset:
       belongs_to: "Author"
-      node: "Nodes (%{count})"
-      node_paginated: "Nodes (%{x}-%{y} of %{count})"
-      way: "Ways (%{count})"
-      way_paginated: "Ways (%{x}-%{y} of %{count})"
-      relation: "Relations (%{count})"
-      relation_paginated: "Relations (%{x}-%{y} of %{count})"
     node:
       title_html: "Node: %{name}"
       history_title_html: "Node History: %{name}"
@@ -478,6 +472,13 @@ en:
       hidden_comment_by_html: "Hidden comment from %{user} %{time_ago}"
       changesetxml: "Changeset XML"
       osmchangexml: "osmChange XML"
+    paging_nav:
+      nodes: "Nodes (%{count})"
+      nodes_paginated: "Nodes (%{x}-%{y} of %{count})"
+      ways: "Ways (%{count})"
+      ways_paginated: "Ways (%{x}-%{y} of %{count})"
+      relations: "Relations (%{count})"
+      relations_paginated: "Relations (%{x}-%{y} of %{count})"
     timeout:
       sorry: "Sorry, the list of changesets you requested took too long to retrieve."
   changeset_comments:
index 14aa743b6278bd9be1c245ba8e79d7c2cab4b441..09406e5ff9b51bfdd972779a1d4cace080052f0d 100644 (file)
@@ -281,10 +281,34 @@ class ChangesetsControllerTest < ActionDispatch::IntegrationTest
   def test_show_element_links
     changeset = create(:changeset)
     node = create(:node, :with_history, :changeset => changeset)
+    way = create(:way, :with_history, :changeset => changeset)
+    relation = create(:relation, :with_history, :changeset => changeset)
 
     sidebar_browse_check :changeset_path, changeset.id, "changesets/show"
     assert_dom "a[href='#{node_path node}']", :count => 1
     assert_dom "a[href='#{old_node_path node, 1}']", :count => 1
+    assert_dom "a[href='#{way_path way}']", :count => 1
+    assert_dom "a[href='#{old_way_path way, 1}']", :count => 1
+    assert_dom "a[href='#{relation_path relation}']", :count => 1
+    assert_dom "a[href='#{old_relation_path relation, 1}']", :count => 1
+  end
+
+  def test_show_paginated_element_links
+    page_size = 20
+    changeset = create(:changeset)
+    nodes = create_list(:node, page_size + 1, :with_history, :changeset => changeset)
+    ways = create_list(:way, page_size + 1, :with_history, :changeset => changeset)
+    relations = create_list(:relation, page_size + 1, :with_history, :changeset => changeset)
+
+    sidebar_browse_check :changeset_path, changeset.id, "changesets/show"
+    page_size.times do |i|
+      assert_dom "a[href='#{node_path nodes[i]}']", :count => 1
+      assert_dom "a[href='#{old_node_path nodes[i], 1}']", :count => 1
+      assert_dom "a[href='#{way_path ways[i]}']", :count => 1
+      assert_dom "a[href='#{old_way_path ways[i], 1}']", :count => 1
+      assert_dom "a[href='#{relation_path relations[i]}']", :count => 1
+      assert_dom "a[href='#{old_relation_path relations[i], 1}']", :count => 1
+    end
   end
 
   ##