Sha256: 1707ca7e07ce87838a8f162c00ac7d5af4536720e67cb789e1a3cbdc27e3dc08
Contents?: true
Size: 733 Bytes
Versions: 62
Compression:
Stored size: 733 Bytes
Contents
module Workarea module Storefront module Pagination extend ActiveSupport::Concern included do delegate :page, :per_page, :total, to: :search_query end def search_query raise( NotImplementedError, "#{self.class} must implement #search_query for Pagination" ) end def total_pages (total.to_f / per_page.to_f).ceil end def first_page? page == 1 end def second_page? page == 2 end def last_page? page == total_pages end def next_page page + 1 unless last_page? end def prev_page page - 1 unless first_page? end end end end
Version data entries
62 entries across 62 versions & 1 rubygems