Sha256: d805754fe24ca94e2c0b65d069309ae1769accdec620b6b54ffc78a5475dc521

Contents?: true

Size: 983 Bytes

Versions: 20

Compression:

Stored size: 983 Bytes

Contents

# See the Pagy documentation: https://ddnexus.github.io/pagy/extras/support
# encoding: utf-8
# frozen_string_literal: true

class Pagy

  module Frontend

    def pagy_prev_url(pagy)
      pagy_url_for(pagy.prev, pagy) if pagy.prev
    end

    def pagy_next_url(pagy)
      pagy_url_for(pagy.next, pagy) if pagy.next
    end

    def pagy_prev_link(pagy, text = pagy_t('pagy.nav.prev'), link_extra = '')
      pagy.prev ? %(<span class="page prev"><a href="#{pagy_prev_url(pagy)}" rel="next" aria-label="next" #{pagy.vars[:link_extra]} #{link_extra}>#{text}</a></span>)
                : %(<span class="page prev disabled">#{text}</span>)
    end

    def pagy_next_link(pagy, text = pagy_t('pagy.nav.next'), link_extra = '')
      pagy.next ? %(<span class="page next"><a href="#{pagy_next_url(pagy)}" rel="next" aria-label="next" #{pagy.vars[:link_extra]} #{link_extra}>#{text}</a></span>)
                : %(<span class="page next disabled">#{text}</span>)
    end

  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
pagy-3.8.1 lib/pagy/extras/support.rb
pagy-3.8.0 lib/pagy/extras/support.rb
pagy-3.7.5 lib/pagy/extras/support.rb
pagy-3.7.4 lib/pagy/extras/support.rb
pagy-3.7.3 lib/pagy/extras/support.rb
pagy-3.7.2 lib/pagy/extras/support.rb
pagy-3.7.1 lib/pagy/extras/support.rb
pagy-3.7.0 lib/pagy/extras/support.rb
pagy-3.6.0 lib/pagy/extras/support.rb
pagy-3.5.1 lib/pagy/extras/support.rb
pagy-3.5.0 lib/pagy/extras/support.rb
pagy-3.4.1 lib/pagy/extras/support.rb
pagy-3.4.0 lib/pagy/extras/support.rb
pagy-3.3.2 lib/pagy/extras/support.rb
pagy-3.3.1 lib/pagy/extras/support.rb
pagy-3.3.0 lib/pagy/extras/support.rb
pagy-3.2.1 lib/pagy/extras/support.rb
pagy-3.2.0 lib/pagy/extras/support.rb
pagy-3.1.0 lib/pagy/extras/support.rb
pagy-3.0.0 lib/pagy/extras/support.rb