From: Tom Hughes Date: Sun, 25 Feb 2024 13:40:11 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/4272' X-Git-Tag: live~251 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/71cb2c50fcaf29e2b933fc981e40a00223d94d34?hp=3360f91733a3aaba670c55427f9195da9c02d981 Merge remote-tracking branch 'upstream/pull/4272' --- diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 1f7c45db5..35c5ba845 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -72,10 +72,6 @@ time[title] { border-color: $grey !important; } -.border-lightgrey { - border-color: $lightgrey !important; -} - /* Rules for the header */ #menu-icon { diff --git a/app/helpers/browse_helper.rb b/app/helpers/browse_helper.rb index 7aa6e4754..67b3c7cf7 100644 --- a/app/helpers/browse_helper.rb +++ b/app/helpers/browse_helper.rb @@ -82,6 +82,29 @@ module BrowseHelper end end + def sidebar_classic_pagination(pages, page_param) + max_width_for_default_padding = 35 + + width = 0 + pagination_items(pages, {}).each do |body| + width += 2 # padding width + width += body.length + end + link_classes = ["page-link", { "px-1" => width > max_width_for_default_padding }] + + tag.ul :class => "pagination pagination-sm mb-1 ms-auto" do + pagination_items(pages, {}).each do |body, n| + linked = !(n.is_a? String) + link = if linked + link_to body, url_for(page_param => n), :class => link_classes + else + tag.span body, :class => link_classes + end + concat tag.li link, :class => ["page-item", { n => !linked }] + end + end + end + private ICON_TAGS = %w[aeroway amenity barrier building highway historic landuse leisure man_made natural railway shop tourism waterway].freeze diff --git a/app/views/browse/_paging_nav.html.erb b/app/views/browse/_paging_nav.html.erb index e13b1a9b8..aa7ee23b9 100644 --- a/app/views/browse/_paging_nav.html.erb +++ b/app/views/browse/_paging_nav.html.erb @@ -1,14 +1,6 @@ -
-
-

<%= heading %>

-
+
+

<%= type_and_paginated_count(type, pages) %>

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

- - <%= raw pagination_links_each(pages, {}) { |n| link_to(n, page_param => n) } %> - -

-
+ <%= sidebar_classic_pagination(pages, "#{type}_page") %> <% end %>
diff --git a/app/views/browse/changeset.html.erb b/app/views/browse/changeset.html.erb index ee8eee66e..db6b9c966 100644 --- a/app/views/browse/changeset.html.erb +++ b/app/views/browse/changeset.html.erb @@ -77,7 +77,7 @@ <% end %> <% unless @ways.empty? %> - <%= render :partial => "paging_nav", :locals => { :heading => type_and_paginated_count("way", @way_pages), :pages => @way_pages, :page_param => "way_page" } %> + <%= render :partial => "paging_nav", :locals => { :type => "way", :pages => @way_pages } %>