From: Anton Khorev Date: Thu, 29 Feb 2024 08:02:30 +0000 (+0300) Subject: Move changeset element headings to changesets locale X-Git-Tag: live~748^2~3 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/7d4b48f0f8cc86abb03d747d71f578265951ba07 Move changeset element headings to changesets locale --- diff --git a/app/helpers/browse_helper.rb b/app/helpers/browse_helper.rb index 67b3c7cf7..53e980fdc 100644 --- a/app/helpers/browse_helper.rb +++ b/app/helpers/browse_helper.rb @@ -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 diff --git a/config/locales/en.yml b/config/locales/en.yml index 616e350d3..18a10f7af 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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: diff --git a/test/controllers/changesets_controller_test.rb b/test/controllers/changesets_controller_test.rb index 14aa743b6..09406e5ff 100644 --- a/test/controllers/changesets_controller_test.rb +++ b/test/controllers/changesets_controller_test.rb @@ -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 ##