Sha256: 94fd76be1880d8443af3df913ccf66e78304c8dce67697b66ad0eedea15cae31

Contents?: true

Size: 797 Bytes

Versions: 15

Compression:

Stored size: 797 Bytes

Contents

module Tolk
  module Pagination
    module Methods
      # Kaminari defaults page_method_name to :page, will_paginate always uses
      # :page
      def pagination_method
        defined?(Kaminari) ? Kaminari.config.page_method_name : :page
      end

      # Kaminari defaults param_name to :page, will_paginate always uses :page
      def pagination_param
        defined?(Kaminari) ? Kaminari.config.param_name : :page
      end
    end

    module ViewHelper
      def tolk_paginate(collection, options = {})
        if respond_to?(:will_paginate)
          # If parent app is using Will Paginate, we need to use it also
          will_paginate collection, options
        else
          # Otherwise use Kaminari
          paginate collection, options
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
tolk-4.0.1 lib/tolk/pagination.rb
tolk-4.0.0 lib/tolk/pagination.rb
tolk-3.2.1 lib/tolk/pagination.rb
tolk-3.2.0 lib/tolk/pagination.rb
tolk-3.1.0 lib/tolk/pagination.rb
tolk-3.0.2 lib/tolk/pagination.rb
tolk-3.0.1 lib/tolk/pagination.rb
tolk-3.0.0 lib/tolk/pagination.rb
tolk-2.0.0 lib/tolk/pagination.rb
tolk-1.9.3 lib/tolk/pagination.rb
tolk-1.8.1 lib/tolk/pagination.rb
tolk-1.9.2 lib/tolk/pagination.rb
tolk-1.9.1 lib/tolk/pagination.rb
tolk-1.9.0 lib/tolk/pagination.rb
tolk-1.8.0 lib/tolk/pagination.rb