Class: Fluxbit::Form::UploadInputComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/fluxbit/form/upload_input_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(form: nil, field: nil, id: nil, height: :md, title: true, subtitle: true, **props) ⇒ UploadInputComponent

rubocop: enable Layout/LineLength



22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/components/fluxbit/form/upload_input_component.rb', line 22

def initialize(form: nil, field: nil, id: nil, height: :md,
               title: true, subtitle: true, **props)
  super
  @form = form
  @object = form&.object
  @field = field
  @id = id
  @title = title
  @subtitle = subtitle
  @props = props
  @height = height.in?(styles[:height].keys) ? height : :md
end

Instance Method Details

#subtitleObject



42
43
44
45
46
# File 'app/components/fluxbit/form/upload_input_component.rb', line 42

def subtitle
  return "SVG, PNG, JPG or GIF (MAX. 800x400px)" if @subtitle == true

  @subtitle
end

#titleObject



35
36
37
38
39
40
# File 'app/components/fluxbit/form/upload_input_component.rb', line 35

def title
  return safe_join((:span, "Click to upload", class: "font-semibold"),
" or drag and drop") if @title == true

  @title
end