From: Anton Khorev Date: Thu, 29 Aug 2024 13:18:40 +0000 (+0300) Subject: Remove type_and_paginated_count helper X-Git-Tag: live~38^2~1 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/ce19596da3f7ba2a1b7bcbbc36a8e78c340c454d?hp=-c Remove type_and_paginated_count helper --- ce19596da3f7ba2a1b7bcbbc36a8e78c340c454d diff --git a/app/helpers/browse_helper.rb b/app/helpers/browse_helper.rb index 482503e8a..5909706fb 100644 --- a/app/helpers/browse_helper.rb +++ b/app/helpers/browse_helper.rb @@ -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 diff --git a/app/views/changesets/_paging_nav.html.erb b/app/views/changesets/_paging_nav.html.erb index 058738222..47b0c7590 100644 --- a/app/views/changesets/_paging_nav.html.erb +++ b/app/views/changesets/_paging_nav.html.erb @@ -1,8 +1,19 @@ -

<%= type_and_paginated_count(type, pages) %>

-<% if pages.page_count > 1 %> +<% if pages.page_count == 1 %> +

+ <%= t ".#{type.pluralize}", :count => pages.item_count %> +

+<% elsif pages.page_count > 1 %> +

+ <%= t ".#{type.pluralize}_paginated", :x => pages.current_page.first_item, + :y => pages.current_page.last_item, + :count => pages.item_count %> +

+ <%= 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 %>