Class: Trek::Form::SoundFieldComponent

Inherits:
ViewComponent::Form::FileFieldComponent
  • Object
show all
Includes:
CssClassesHelpers, StimulusHelpers, Turbo::FramesHelper
Defined in:
app/components/trek/form/sound_field_component.rb

Instance Method Summary collapse

Methods included from StimulusHelpers

#stimulus_action, #stimulus_class, #stimulus_class_hash, #stimulus_class_key, #stimulus_target, #stimulus_target_hash, #stimulus_target_key, #stimulus_value, #stimulus_value_hash, #stimulus_value_key

Methods included from CssClassesHelpers

#class_for, #class_names_for, #root_class

Methods included from IdentifierHelper

#identifier

Instance Method Details

#button_textObject



32
33
34
# File 'app/components/trek/form/sound_field_component.rb', line 32

def button_text
  sound&.exists? ? t("admin.actions.replace") : t("admin.actions.browse")
end

#cached_dataObject



22
23
24
# File 'app/components/trek/form/sound_field_component.rb', line 22

def cached_data
  object.public_send(:"cached_#{method_name}_data")
end

#existing_dataObject



18
19
20
# File 'app/components/trek/form/sound_field_component.rb', line 18

def existing_data
  object.public_send(:"#{method_name}_data")
end

#file_field_data_attributesObject



26
27
28
29
30
# File 'app/components/trek/form/sound_field_component.rb', line 26

def file_field_data_attributes
  {
    action: stimulus_action("addFiles")
  }.merge(stimulus_target_hash("fileInput"))
end

#soundObject



10
11
12
# File 'app/components/trek/form/sound_field_component.rb', line 10

def sound
  object.public_send(:"#{method_name}")
end

#sound_urlObject



14
15
16
# File 'app/components/trek/form/sound_field_component.rb', line 14

def sound_url
  object.public_send(:"#{method_name}_url")
end