Sha256: fe5d0907dce57af1833c285bbd03e1e4e5056ce212e84c3c95d82aacb548943f

Contents?: true

Size: 834 Bytes

Versions: 8

Compression:

Stored size: 834 Bytes

Contents

require 'kaminari'

module Europeana
  module Blacklight
    class Response
      ##
      # Pagination for{Europeana::Blacklight::Response}
      #
      # Based on {Blacklight::SolrResponse::Pagination} v5.10.2
      module Pagination
        include Kaminari::PageScopeMethods
        include Kaminari::ConfigurationMethods::ClassMethods

        def limit_value
          rows
        end

        def offset_value
          start
        end

        def total_count
          total
        end

        def model_name
          return unless docs.present? && docs.first.respond_to?(:model_name)
          docs.first.model_name
        end

        def next_page
          current_page + 1 unless last_page?
        end

        def prev_page
          current_page - 1 unless first_page?
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
europeana-blacklight-0.2.7 lib/europeana/blacklight/response/pagination.rb
europeana-blacklight-0.2.6 lib/europeana/blacklight/response/pagination.rb
europeana-blacklight-0.2.5 lib/europeana/blacklight/response/pagination.rb
europeana-blacklight-0.2.3 lib/europeana/blacklight/response/pagination.rb
europeana-blacklight-0.2.2 lib/europeana/blacklight/response/pagination.rb
europeana-blacklight-0.2.1 lib/europeana/blacklight/response/pagination.rb
europeana-blacklight-0.2.0 lib/europeana/blacklight/response/pagination.rb
europeana-blacklight-0.1.0 lib/europeana/blacklight/response/pagination.rb