Class: FlexiAdmin::Components::Resources::BulkAction::ButtonComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- FlexiAdmin::Components::Resources::BulkAction::ButtonComponent
- Includes:
- Helpers::IconHelper, Helpers::UrlHelper
- Defined in:
- lib/flexi_admin/components/resources/bulk_action/button_component.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#disabled ⇒ Object
readonly
Returns the value of attribute disabled.
-
#modal_class ⇒ Object
readonly
Returns the value of attribute modal_class.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#selection_dependent ⇒ Object
readonly
Returns the value of attribute selection_dependent.
Instance Method Summary collapse
- #css_utility_classes ⇒ Object
-
#initialize(context, modal_class, disabled: true, selection_dependent: true, **options) ⇒ ButtonComponent
constructor
A new instance of ButtonComponent.
- #scoped_url_with_modal_id ⇒ Object
Methods included from Helpers::IconHelper
Constructor Details
#initialize(context, modal_class, disabled: true, selection_dependent: true, **options) ⇒ ButtonComponent
Returns a new instance of ButtonComponent.
10 11 12 13 14 15 16 |
# File 'lib/flexi_admin/components/resources/bulk_action/button_component.rb', line 10 def initialize(context, modal_class, disabled: true, selection_dependent: true, **) @context = context @modal_class = modal_class @disabled = selection_dependent && disabled @selection_dependent = selection_dependent @options = end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
8 9 10 |
# File 'lib/flexi_admin/components/resources/bulk_action/button_component.rb', line 8 def context @context end |
#disabled ⇒ Object (readonly)
Returns the value of attribute disabled.
8 9 10 |
# File 'lib/flexi_admin/components/resources/bulk_action/button_component.rb', line 8 def disabled @disabled end |
#modal_class ⇒ Object (readonly)
Returns the value of attribute modal_class.
8 9 10 |
# File 'lib/flexi_admin/components/resources/bulk_action/button_component.rb', line 8 def modal_class @modal_class end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/flexi_admin/components/resources/bulk_action/button_component.rb', line 8 def @options end |
#selection_dependent ⇒ Object (readonly)
Returns the value of attribute selection_dependent.
8 9 10 |
# File 'lib/flexi_admin/components/resources/bulk_action/button_component.rb', line 8 def selection_dependent @selection_dependent end |
Instance Method Details
#css_utility_classes ⇒ Object
18 19 20 21 22 23 |
# File 'lib/flexi_admin/components/resources/bulk_action/button_component.rb', line 18 def css_utility_classes classes = [] classes << "disabled" if disabled classes << "selection-dependent" if selection_dependent classes.compact.join(" ") end |
#scoped_url_with_modal_id ⇒ Object
25 26 27 |
# File 'lib/flexi_admin/components/resources/bulk_action/button_component.rb', line 25 def scoped_url_with_modal_id main_app.admin_modals_path(kind: modal_class.modal_id, **context.to_params) end |