Class: Plutonium::UI::Grid::Resource
- Inherits:
-
Component::Base
- Object
- Component::Base
- Plutonium::UI::Grid::Resource
- Defined in:
- lib/plutonium/ui/grid/resource.rb
Overview
Renders a paginated collection of records as a responsive grid of Card components. Mirrors the structure of Table::Resource (filter panel, scopes pills, bulk actions, footer) so view-switching is purely a render-shape change.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#resource_definition ⇒ Object
readonly
Returns the value of attribute resource_definition.
-
#resource_fields ⇒ Object
readonly
Returns the value of attribute resource_fields.
Instance Method Summary collapse
-
#initialize(collection, resource_fields:, resource_definition:) ⇒ Resource
constructor
A new instance of Resource.
- #view_template ⇒ Object
Methods included from Component::Behaviour
Methods included from Component::Tokens
Methods included from Component::Kit
#BuildActionButton, #BuildActionsDropdown, #BuildBlock, #BuildBreadcrumbs, #BuildBulkActionsToolbar, #BuildColorModeSelector, #BuildDynaFrameContent, #BuildDynaFrameHost, #BuildEmptyCard, #BuildFrameNavigatorPanel, #BuildModalCentered, #BuildModalSlideover, #BuildPageHeader, #BuildPanel, #BuildRowActionsDropdown, #BuildSkeletonTable, #BuildTabList, #BuildTableFilterPills, #BuildTableInfo, #BuildTablePagination, #BuildTableScopesBar, #BuildTableScopesPills, #BuildTableSearchBar, #BuildTableToolbar, #BuildTableViewSwitcher, #method_missing, #respond_to_missing?
Constructor Details
#initialize(collection, resource_fields:, resource_definition:) ⇒ Resource
Returns a new instance of Resource.
13 14 15 16 17 |
# File 'lib/plutonium/ui/grid/resource.rb', line 13 def initialize(collection, resource_fields:, resource_definition:) @collection = collection @resource_fields = resource_fields @resource_definition = resource_definition end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Plutonium::UI::Component::Kit
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
11 12 13 |
# File 'lib/plutonium/ui/grid/resource.rb', line 11 def collection @collection end |
#resource_definition ⇒ Object (readonly)
Returns the value of attribute resource_definition.
11 12 13 |
# File 'lib/plutonium/ui/grid/resource.rb', line 11 def resource_definition @resource_definition end |
#resource_fields ⇒ Object (readonly)
Returns the value of attribute resource_fields.
11 12 13 |
# File 'lib/plutonium/ui/grid/resource.rb', line 11 def resource_fields @resource_fields end |
Instance Method Details
#view_template ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/plutonium/ui/grid/resource.rb', line 19 def view_template div(data: filter_panel_controller_data) do render_scopes_pills div(data: bulk_actions_controller_data) do render_filter_pills collection.empty? ? render_empty_card : render_grid end if current_query_object.filter_definitions.present? end end |