Sha256: feb40e34d6dc302fb9a19eae4bc398d8597fb390bb0f25a23755732625ea19c3

Contents?: true

Size: 799 Bytes

Versions: 9

Compression:

Stored size: 799 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

9 entries across 9 versions & 1 rubygems

Version Path
tolk-6.0.0 lib/tolk/pagination.rb
tolk-6.0.0.alpha1 lib/tolk/pagination.rb
tolk-5.0.2 lib/tolk/pagination.rb
tolk-5.0.1 lib/tolk/pagination.rb
tolk-5.0.0 lib/tolk/pagination.rb
tolk-4.3.0 lib/tolk/pagination.rb
tolk-4.2.0 lib/tolk/pagination.rb
tolk-4.1.1 lib/tolk/pagination.rb
tolk-4.1.0 lib/tolk/pagination.rb