From 7cefa8577ac5213ae30d5a472b5981bd2c6f4767 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Mon, 26 Jun 2023 02:50:21 +0200 Subject: [PATCH] Bump will_paginate --- Gemfile | 2 +- Gemfile.lock | 4 ++-- config/initializers/will_paginate.rb | 16 ++++++++++------ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index 1e5846d26..2ec6fc10a 100644 --- a/Gemfile +++ b/Gemfile @@ -157,7 +157,7 @@ gem "gon", "6.4.0" gem "hamlit", "3.0.3" gem "mobile-fu", "1.4.0" gem "rails-timeago", "2.20.0" -gem "will_paginate", "3.3.1" +gem "will_paginate", "4.0.0" # Logging diff --git a/Gemfile.lock b/Gemfile.lock index 237f7fd15..8addc9700 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -778,7 +778,7 @@ GEM websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - will_paginate (3.3.1) + will_paginate (4.0.0) xpath (3.2.0) nokogiri (~> 1.8) yajl-ruby (1.4.3) @@ -901,7 +901,7 @@ DEPENDENCIES uuid (= 2.3.9) versionist (= 2.0.1) webmock (= 3.14.0) - will_paginate (= 3.3.1) + will_paginate (= 4.0.0) yajl-ruby (= 1.4.3) BUNDLED WITH diff --git a/config/initializers/will_paginate.rb b/config/initializers/will_paginate.rb index f48c76cbd..46c24b49d 100644 --- a/config/initializers/will_paginate.rb +++ b/config/initializers/will_paginate.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true -require 'will_paginate/array' +require "will_paginate/array" # Optional for Bootstrap :renderer => WillPaginate::ActionView::BootstrapLinkRenderer # https://github.com/yrgoldteeth/bootstrap-will_paginate module WillPaginate module ActionView - def will_paginate(collection = nil, options = {} ) + def will_paginate(collection=nil, options={}) options, collection = collection, nil if collection.is_a? Hash # Taken from original will_paginate code to handle if the helper is not passed a collection object. collection ||= infer_collection_from_controller @@ -23,15 +23,19 @@ module WillPaginate end def page_number(page) - tag :li, link(page, page, :rel => rel_value(page)), :class => ('active' if page == current_page) + tag :li, link(page, page, rel: rel_value(page)), class: ("active" if page == current_page) end def gap - tag :li, link(super, '#'), :class => 'disabled' + tag :li, link(super, "#"), class: "disabled" end - def previous_or_next_page(page, text, classname) - tag :li, link(text, page || '#'), :class => [classname[0..3], classname, ('disabled' unless page)].join(' ') + def previous_or_next_page(page, text, classname, aria_label=nil) + tag :li, link(text, page || "#"), + { + class: [classname[0..3], classname, ("disabled" unless page)].join(" "), + "aria-label": aria_label + } end end end