Module: UI::AlertDialogActionBehavior
- Included in:
- AlertDialogAction
- Defined in:
- app/behaviors/ui/alert_dialog_action_behavior.rb
Overview
Shared behavior for AlertDialog Action component This wraps the Button component with alert dialog close action
Instance Method Summary collapse
-
#alert_dialog_action_button_data_attributes ⇒ Object
Build data attributes hash to pass to Button component.
-
#alert_dialog_action_data_attributes ⇒ Object
Data attributes for Stimulus action.
-
#merged_alert_dialog_action_data_attributes ⇒ Object
Merge user-provided data attributes.
Instance Method Details
#alert_dialog_action_button_data_attributes ⇒ Object
Build data attributes hash to pass to Button component
22 23 24 25 26 |
# File 'app/behaviors/ui/alert_dialog_action_behavior.rb', line 22 def { data: merged_alert_dialog_action_data_attributes } end |
#alert_dialog_action_data_attributes ⇒ Object
Data attributes for Stimulus action
9 10 11 12 13 |
# File 'app/behaviors/ui/alert_dialog_action_behavior.rb', line 9 def alert_dialog_action_data_attributes { action: "click->ui--alert-dialog#close" } end |
#merged_alert_dialog_action_data_attributes ⇒ Object
Merge user-provided data attributes
16 17 18 19 |
# File 'app/behaviors/ui/alert_dialog_action_behavior.rb', line 16 def merged_alert_dialog_action_data_attributes user_data = @attributes&.fetch(:data, {}) || {} user_data.merge(alert_dialog_action_data_attributes) end |