Module: WildayUi::Components::Button::Features::Loading

Included in:
WildayUi::Components::Button::FeatureEngine
Defined in:
app/helpers/wilday_ui/components/button/features/loading.rb

Constant Summary collapse

FEATURE_CONFIG =
{
  wrapper_required: false,
  stimulus_controller: "button",
  default_stimulus_action: "click->button#toggleLoading"
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.feature_configObject



12
13
14
# File 'app/helpers/wilday_ui/components/button/features/loading.rb', line 12

def self.feature_config
  { loading: FEATURE_CONFIG }
end

Instance Method Details

#setup_loading_data_attributes(options, loading_text) ⇒ Object



23
24
25
26
27
# File 'app/helpers/wilday_ui/components/button/features/loading.rb', line 23

def setup_loading_data_attributes(options, loading_text)
  return unless loading_text.present?
  options[:data] ||= {}
  options[:data][:button_loading_text] = loading_text
end

#setup_loading_options(options, loading_text) ⇒ Object



16
17
18
19
20
21
# File 'app/helpers/wilday_ui/components/button/features/loading.rb', line 16

def setup_loading_options(options, loading_text)
  return unless loading_text.present?

  feature_config = FEATURE_CONFIG
  setup_feature_controller(options, feature_config, loading_text)
end