From 53488166afbc4432d796bbe7d67c10cd63b62861 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sun, 15 Oct 2023 22:41:55 +0300 Subject: [PATCH] Build pagination css classes without mutating arrays --- app/views/browse/_paging_nav.html.erb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/views/browse/_paging_nav.html.erb b/app/views/browse/_paging_nav.html.erb index 778f51a1f..13cf7c283 100644 --- a/app/views/browse/_paging_nav.html.erb +++ b/app/views/browse/_paging_nav.html.erb @@ -10,15 +10,12 @@ width += 2 # padding width width += body.length end - link_classes = ["page-link"] - link_classes.push("px-1") if width > max_width_for_default_padding + link_classes = ["page-link", {"px-1" => width > max_width_for_default_padding}] pagination_items(pages, {}).each do |body, n| linked = !(n.is_a? String) - item_classes = ["page-item"] - item_classes.push(n) unless linked %> - <%= content_tag "li", :class => item_classes do + <%= content_tag "li", :class => ["page-item", {n => !linked}] do if linked link_to(body, url_for(page_param => n), :class => link_classes) else -- 2.39.5