Sha256: 99bb076c26a6fa2ca5c50511783911ca4d3e0f2403bc81f6ba7625ef1d55253a

Contents?: true

Size: 573 Bytes

Versions: 2

Compression:

Stored size: 573 Bytes

Contents

module ActiveAdminPagination
  module ResourceDSL
    def pagination per_page_sizes, per_page_default_size = per_page_sizes.first
      controller do
        before_filter :paginate
        def paginate
          @per_page = params[:per_page] || per_page_default_size
        end
      end

      sidebar "Pagination", only: :index do
        render partial: "paginate",
               locals: {
                 per_page_sizes: per_page_sizes,
                 current_per_page_size: params[:per_page] || per_page_default_size
               }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_admin_pagination-0.2.1 lib/active_admin_pagination/resource_dsl.rb
active_admin_pagination-0.2.0 lib/active_admin_pagination/resource_dsl.rb