module Yaqb::QueryBuilders::Paginators::WillPaginateHelper
Private Instance Methods
default_per_page()
click to toggle source
# File lib/yaqb/query_builders/paginators/will_paginate_helper.rb, line 38 def default_per_page WillPaginate.per_page end
pages()
click to toggle source
# File lib/yaqb/query_builders/paginators/will_paginate_helper.rb, line 29 def pages @pages ||= {}.tap do |h| h[:first] = 1 if show_first_link? h[:prev] = @scope.current_page - 1 if show_previous_link? h[:next] = @scope.current_page + 1 if show_next_link? h[:last] = @scope.total_pages if show_last_link? end end
paginate!(scope)
click to toggle source
# File lib/yaqb/query_builders/paginators/will_paginate_helper.rb, line 9 def paginate!(scope) scope.paginate(page: @page, per_page: @per) end
show_first_link?()
click to toggle source
# File lib/yaqb/query_builders/paginators/will_paginate_helper.rb, line 13 def show_first_link? @scope.total_pages > 1 && !!@scope.previous_page end
show_last_link?()
click to toggle source
# File lib/yaqb/query_builders/paginators/will_paginate_helper.rb, line 25 def show_last_link? @scope.total_pages > 1 && !!@scope.next_page end
show_next_link?()
click to toggle source
# File lib/yaqb/query_builders/paginators/will_paginate_helper.rb, line 21 def show_next_link? !!@scope.next_page end
show_previous_link?()
click to toggle source
# File lib/yaqb/query_builders/paginators/will_paginate_helper.rb, line 17 def show_previous_link? !!@scope.previous_page end