Sha256: 223f16d6e84fecb6e2d39fa9070a151e88fcd68edd21613a7ced568edc1149fb

Contents?: true

Size: 533 Bytes

Versions: 1

Compression:

Stored size: 533 Bytes

Contents

# See the Pagy documentation: https://ddnexus.github.io/pagy/extras/trim
# frozen_string_literal: true

class Pagy

  module UseTrimExtra

    def pagy_link_proc(pagy, link_extra='')
      link_proc = super(pagy, link_extra)
      lambda do |num, text=num, extra=''|
        link = link_proc.call(num, text, extra)
        if num == 1
         link.sub!(/[?&]#{pagy.vars[:page_param]}=1\b(?!&)|\b#{pagy.vars[:page_param]}=1&/, '')
        else
          link
        end
      end
    end

  end
  Frontend.prepend UseTrimExtra

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pagy-4.2.0 lib/pagy/extras/trim.rb