Sha256: 0ef781f31af8d547f1f5ee142d0ed79046d5f5934d31a4bf9fbb0bb9a354f4f0

Contents?: true

Size: 912 Bytes

Versions: 52

Compression:

Stored size: 912 Bytes

Contents

module Para
  module Admin
    module PaginationHelper
      def page_entries(resources)
        page_entries_info(resources) + per_page_select
      end

      private

      def per_page_select
        options = [25, 50, 100, 250, 500, 1000]

        params = (Rack::Utils.parse_query(request.env['QUERY_STRING']).symbolize_keys rescue {})
        params.delete(:page)
        count_with_url = options.each_with_object({}) do |count, hash|
          query = params.merge(:per_page => count)
          url  = request.env['PATH_INFO'] + (query.empty? ? '' : "?#{query.to_query}")
      
          hash[count] = url
        end

        current_per_page = params[:per_page] || Kaminari.config.default_per_page

        render partial: 'para/admin/resources/per_page_select', locals: { 
          count_with_url: count_with_url, 
          current_per_page: current_per_page 
        }
      end
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
para-0.12.4 app/helpers/para/admin/pagination_helper.rb
para-0.12.3 app/helpers/para/admin/pagination_helper.rb
para-0.12.2 app/helpers/para/admin/pagination_helper.rb
para-0.12.1 app/helpers/para/admin/pagination_helper.rb
para-0.12.0 app/helpers/para/admin/pagination_helper.rb
para-0.11.4 app/helpers/para/admin/pagination_helper.rb
para-0.11.3 app/helpers/para/admin/pagination_helper.rb
para-0.11.2 app/helpers/para/admin/pagination_helper.rb
para-0.11.1 app/helpers/para/admin/pagination_helper.rb
para-0.11.0 app/helpers/para/admin/pagination_helper.rb
para-0.10.0 app/helpers/para/admin/pagination_helper.rb
para-0.9.4 app/helpers/para/admin/pagination_helper.rb
para-0.9.3.3 app/helpers/para/admin/pagination_helper.rb
para-0.9.3.2 app/helpers/para/admin/pagination_helper.rb
para-0.9.3.1 app/helpers/para/admin/pagination_helper.rb
para-0.9.2 app/helpers/para/admin/pagination_helper.rb
para-0.9.0 app/helpers/para/admin/pagination_helper.rb
para-0.8.15 app/helpers/para/admin/pagination_helper.rb
para-0.8.14 app/helpers/para/admin/pagination_helper.rb
para-0.8.13 app/helpers/para/admin/pagination_helper.rb