]> git.openstreetmap.org Git - rails.git/commitdiff
Remove type_and_paginated_count helper
authorAnton Khorev <tony29@yandex.ru>
Thu, 29 Aug 2024 13:18:40 +0000 (16:18 +0300)
committerAnton Khorev <tony29@yandex.ru>
Wed, 15 Jan 2025 23:52:11 +0000 (02:52 +0300)
app/helpers/browse_helper.rb
app/views/changesets/_paging_nav.html.erb

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..47b0c7590e72b6a00ac04c3ca1346ca1eb580843 100644 (file)
@@ -1,8 +1,19 @@
-<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}", :count => pages.item_count %>
+  </h4>
+<% elsif pages.page_count > 1 %>
+  <h4 class="fs-5">
+    <%= t ".#{type.pluralize}_paginated", :x => pages.current_page.first_item,
+                                          :y => pages.current_page.last_item,
+                                          :count => pages.item_count %>
+  </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 %>