Class: Plutonium::Action::Interactive
- Defined in:
- lib/plutonium/action/interactive.rb
Overview
InteractiveAction class for handling interactive actions in the Plutonium framework
Defined Under Namespace
Classes: Factory
Instance Attribute Summary collapse
-
#immediate ⇒ Boolean
readonly
Whether the action is executed immediately.
-
#interaction ⇒ Class
readonly
The interaction class associated with this action.
Attributes inherited from Base
#category, #color, #description, #icon, #label, #name, #position, #return_to, #route_options, #turbo, #turbo_frame
Instance Method Summary collapse
-
#confirmation ⇒ String?
Get the confirmation message for the action.
-
#initialize(name, interaction:, immediate:, **options) ⇒ Interactive
constructor
Initialize a new InteractiveAction.
Methods inherited from Base
#bulk_action?, #collection_record_action?, #permitted_by?, #record_action?, #resource_action?
Constructor Details
#initialize(name, interaction:, immediate:, **options) ⇒ Interactive
Initialize a new InteractiveAction
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/plutonium/action/interactive.rb', line 18 def initialize(name, interaction:, immediate:, **) @interaction = interaction @immediate = immediate [:label] ||= interaction.label [:description] ||= interaction.description [:icon] ||= interaction.icon [:turbo_frame] = "remote_modal" unless .key?(:turbo_frame) super(name, **) end |
Instance Attribute Details
#immediate ⇒ Boolean (readonly)
Whether the action is executed immediately
9 10 11 |
# File 'lib/plutonium/action/interactive.rb', line 9 def immediate @immediate end |
#interaction ⇒ Class (readonly)
The interaction class associated with this action
9 10 11 |
# File 'lib/plutonium/action/interactive.rb', line 9 def interaction @interaction end |
Instance Method Details
#confirmation ⇒ String?
Get the confirmation message for the action
33 34 35 |
# File 'lib/plutonium/action/interactive.rb', line 33 def confirmation super || (@immediate ? "#{label}?" : nil) end |