]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/4872'
authorTom Hughes <tom@compton.nu>
Tue, 25 Mar 2025 19:15:47 +0000 (19:15 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 25 Mar 2025 19:15:47 +0000 (19:15 +0000)
app/helpers/browse_helper.rb
app/views/changesets/_paging_nav.html.erb
config/locales/en.yml

index 482503e8ae66b3c48e5be261e5974c5d66aba821..5909706fb482533cc06f25e9ebb53b63e0dd47b2 100644 (file)
@@ -79,18 +79,6 @@ module BrowseHelper
     "nofollow" if object.tags.empty?
   end
 
-  def type_and_paginated_count(type, pages, selected_page = pages.current_page)
-    if pages.page_count == 1
-      t ".#{type.pluralize}",
-        :count => pages.item_count
-    else
-      t ".#{type.pluralize}_paginated",
-        :x => selected_page.first_item,
-        :y => selected_page.last_item,
-        :count => pages.item_count
-    end
-  end
-
   def sidebar_classic_pagination(pages, page_param)
     max_width_for_default_padding = 35
 
index 0587382222de27d64af44dc64dbc04ffff8c1a03..9fa23f6701f2bf438adc5ee818937561814703da 100644 (file)
@@ -1,8 +1,25 @@
-<h4 class="fs-5"><%= type_and_paginated_count(type, pages) %></h4>
-<% if pages.page_count > 1 %>
+<% if pages.page_count == 1 %>
+  <h4 class="fs-5">
+    <%= t ".#{type.pluralize}_title" %>
+    <span class="badge count-number">
+      <%= pages.item_count %>
+    </span>
+  </h4>
+<% elsif pages.page_count > 1 %>
+  <h4 class="fs-5">
+    <%= t ".#{type.pluralize}_title" %>
+    <span class="badge count-number">
+      <%= t ".range", :x => pages.current_page.first_item,
+                      :y => pages.current_page.last_item,
+                      :count => pages.item_count %>
+    </span>
+  </h4>
+
   <%= sidebar_classic_pagination(pages, "#{type}_page") do |page|
         {
-          :title => type_and_paginated_count(type, pages, page),
+          :title => t(".#{type.pluralize}_paginated", :x => page.first_item,
+                                                      :y => page.last_item,
+                                                      :count => pages.item_count),
           :data => { :turbo => "true" }
         }
       end %>
index 230d9242c5b1c28aa42a299e1ea73288c829f438..aba37e9344ea41d983f004d2fbdade2849d4a88f 100644 (file)
@@ -522,12 +522,13 @@ en:
       changesetxml: "Changeset XML"
       osmchangexml: "osmChange XML"
     paging_nav:
-      nodes: "Nodes (%{count})"
+      nodes_title: "Nodes"
       nodes_paginated: "Nodes (%{x}-%{y} of %{count})"
-      ways: "Ways (%{count})"
+      ways_title: "Ways"
       ways_paginated: "Ways (%{x}-%{y} of %{count})"
-      relations: "Relations (%{count})"
+      relations_title: "Relations"
       relations_paginated: "Relations (%{x}-%{y} of %{count})"
+      range: "%{x}-%{y} of %{count}"
     not_found_message:
       sorry: "Sorry, changeset #%{id} could not be found."
     timeout: