Sha256: f4985ff7b6521bba0077043a943854b7a117f30f91b1c30f9134b0f1a05827fb

Contents?: true

Size: 579 Bytes

Versions: 1

Compression:

Stored size: 579 Bytes

Contents

module ActiveAdminPagination
  module PaginationSidebar
    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

1 entries across 1 versions & 1 rubygems

Version Path
active_admin_pagination-0.1.0 lib/active_admin_pagination/pagination_sidebar.rb