Module: UI::AlertDialogCancelBehavior

Included in:
AlertDialogCancel
Defined in:
app/behaviors/ui/alert_dialog_cancel_behavior.rb

Overview

Shared behavior for AlertDialog Cancel component This wraps the Button component with alert dialog close action

Instance Method Summary collapse

Instance Method Details

#alert_dialog_cancel_button_data_attributesObject

Build data attributes hash to pass to Button component



22
23
24
25
26
# File 'app/behaviors/ui/alert_dialog_cancel_behavior.rb', line 22

def alert_dialog_cancel_button_data_attributes
  {
    data: merged_alert_dialog_cancel_data_attributes
  }
end

#alert_dialog_cancel_data_attributesObject

Data attributes for Stimulus action



9
10
11
12
13
# File 'app/behaviors/ui/alert_dialog_cancel_behavior.rb', line 9

def alert_dialog_cancel_data_attributes
  {
    action: "click->ui--alert-dialog#close"
  }
end

#merged_alert_dialog_cancel_data_attributesObject

Merge user-provided data attributes



16
17
18
19
# File 'app/behaviors/ui/alert_dialog_cancel_behavior.rb', line 16

def merged_alert_dialog_cancel_data_attributes
  user_data = @attributes&.fetch(:data, {}) || {}
  user_data.merge(alert_dialog_cancel_data_attributes)
end