Class: FoxTail::DropzoneComponent

Inherits:
BaseComponent show all
Includes:
Concerns::Formable, Concerns::HasStimulusController
Defined in:
app/components/fox_tail/dropzone_component.rb

Defined Under Namespace

Classes: StimulusController

Constant Summary collapse

DEFAULT_ICON =
"cloud-arrow-up"

Instance Attribute Summary

Attributes inherited from BaseComponent

#html_attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseComponent

classname_merger, #initialize, stimulus_merger, use_stimulus?, #with_html_attributes, #with_html_class

Methods inherited from Base

fox_tail_config

Constructor Details

This class inherits a constructor from FoxTail::BaseComponent

Class Method Details

.stimulus_controller_nameObject



61
62
63
# File 'app/components/fox_tail/dropzone_component.rb', line 61

def stimulus_controller_name
  "form-field"
end

Instance Method Details

#before_renderObject



38
39
40
41
42
43
44
45
46
47
48
# File 'app/components/fox_tail/dropzone_component.rb', line 38

def before_render
  super

  with_icon DEFAULT_ICON, variant: :outline unless icon?
  with_title I18n.t("components.fox_tail.dropzone.title_html").html_safe unless title?

  add_default_name_and_id

  html_attributes[:type] = :file
  html_attributes[:class] = theme.apply(:root, self)
end

#stimulus_controller_optionsObject



34
35
36
# File 'app/components/fox_tail/dropzone_component.rb', line 34

def stimulus_controller_options
  {}
end

#use_stimulus?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'app/components/fox_tail/dropzone_component.rb', line 30

def use_stimulus?
  super && controlled?
end