Class: ActiveAdmin::Views::PaginatedCollection
Overview
Wraps the content with pagination and available formats.
Example:
paginated_collection collection, :entry_name => "Post" do
div do
h2 "Inside the
end
end
This will create a div with a sentence describing the number of posts in one of the following formats:
-
“No Posts found”
-
“Displaying all 10 Posts”
-
“Displaying Posts 1 - 30 of 31 in total”
It will also generate pagination links.
Instance Method Summary collapse
-
#add_child(*args, &block) ⇒ Object
Override add_child to insert all children into the @contents div.
-
#build(collection, options = {}) ⇒ Object
Builds a new paginated collection component.
Methods inherited from Component
Constructor Details
This class inherits a constructor from ActiveAdmin::Component
Instance Method Details
#add_child(*args, &block) ⇒ Object
Override add_child to insert all children into the @contents div
43 44 45 46 47 48 49 |
# File 'lib/active_admin/views/components/paginated_collection.rb', line 43 def add_child(*args, &block) if @built @contents.add_child(*args, &block) else super end end |
#build(collection, options = {}) ⇒ Object
Builds a new paginated collection component
34 35 36 37 38 39 40 |
# File 'lib/active_admin/views/components/paginated_collection.rb', line 34 def build(collection, = {}) @collection = collection div(page_entries_info().html_safe, :class => "pagination_information") @contents = div(:class => "paginated_collection_contents") build_pagination_with_formats @built = true end |