Class: IronAdmin::Resources::BulkActionsComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- IronAdmin::Resources::BulkActionsComponent
- Defined in:
- app/components/iron_admin/resources/bulk_actions_component.rb
Overview
Renders the bulk actions dropdown for selected records.
Instance Attribute Summary collapse
-
#actions ⇒ Array<Hash>
readonly
Defined bulk actions.
-
#resource_class ⇒ Class
readonly
The resource class.
Instance Method Summary collapse
-
#action_url(action) ⇒ String
private
URL for executing the bulk action.
-
#initialize(actions:, resource_class:) ⇒ BulkActionsComponent
constructor
A new instance of BulkActionsComponent.
-
#render? ⇒ Boolean
private
Whether to render the component.
-
#theme ⇒ IronAdmin::Configuration::Theme
private
Theme configuration.
Constructor Details
#initialize(actions:, resource_class:) ⇒ BulkActionsComponent
Returns a new instance of BulkActionsComponent.
15 16 17 18 |
# File 'app/components/iron_admin/resources/bulk_actions_component.rb', line 15 def initialize(actions:, resource_class:) @actions = actions @resource_class = resource_class end |
Instance Attribute Details
#actions ⇒ Array<Hash> (readonly)
Returns Defined bulk actions.
8 9 10 |
# File 'app/components/iron_admin/resources/bulk_actions_component.rb', line 8 def actions @actions end |
#resource_class ⇒ Class (readonly)
Returns The resource class.
11 12 13 |
# File 'app/components/iron_admin/resources/bulk_actions_component.rb', line 11 def resource_class @resource_class end |
Instance Method Details
#action_url(action) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns URL for executing the bulk action.
29 30 31 |
# File 'app/components/iron_admin/resources/bulk_actions_component.rb', line 29 def action_url(action) helpers.iron_admin.resource_bulk_action_path(resource_class.resource_name, action[:name]) end |
#render? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Whether to render the component.
35 36 37 |
# File 'app/components/iron_admin/resources/bulk_actions_component.rb', line 35 def render? actions.any? end |
#theme ⇒ IronAdmin::Configuration::Theme
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Theme configuration.
22 23 24 |
# File 'app/components/iron_admin/resources/bulk_actions_component.rb', line 22 def theme IronAdmin.configuration.theme end |