module Yaqb::QueryBuilders::Paginators::PagyHelper
Private Instance Methods
default_per_page()
click to toggle source
# File lib/yaqb/query_builders/paginators/pagy_helper.rb, line 39 def default_per_page Pagy::VARS[:items] end
pages()
click to toggle source
# File lib/yaqb/query_builders/paginators/pagy_helper.rb, line 30 def pages @pages ||= {}.tap do |h| h[:first] = 1 if show_first_link? h[:prev] = @pagy.prev if show_previous_link? h[:next] = @pagy.next if show_next_link? h[:last] = @pagy.pages if show_last_link? end end
paginate!(scope)
click to toggle source
# File lib/yaqb/query_builders/paginators/pagy_helper.rb, line 9 def paginate!(scope) @pagy = Pagy.new(count: scope.count(:all), page: @page, items: @per) scope.offset(@pagy.offset).limit(@pagy.items) end
show_first_link?()
click to toggle source
# File lib/yaqb/query_builders/paginators/pagy_helper.rb, line 14 def show_first_link? @pagy.pages > 1 && !!@pagy.prev end
show_last_link?()
click to toggle source
# File lib/yaqb/query_builders/paginators/pagy_helper.rb, line 26 def show_last_link? @pagy.pages > 1 && !!@pagy.next end
show_next_link?()
click to toggle source
# File lib/yaqb/query_builders/paginators/pagy_helper.rb, line 22 def show_next_link? !!@pagy.next end
show_previous_link?()
click to toggle source
# File lib/yaqb/query_builders/paginators/pagy_helper.rb, line 18 def show_previous_link? !!@pagy.prev end