Class: Fluxbit::Form::SelectFreeInputComponent

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

Instance Method Summary collapse

Constructor Details

#initialize(free_option: "Specify...", **kwargs, &block) ⇒ SelectFreeInputComponent



4
5
6
7
8
9
10
# File 'app/components/fluxbit/form/select_free_input_component.rb', line 4

def initialize(free_option: "Specify...", **kwargs, &block)
  super

  @kwargs = kwargs
  @block = block
  @free_option = free_option
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/components/fluxbit/form/select_free_input_component.rb', line 12

def call
  if @kwargs[:with_content]
    content = @kwargs.delete(:with_content)
     :div do
      concat render(Fluxbit::Form::SelectInputComponent.new(**select_params).with_content(content), &@block)
      concat render(Fluxbit::Form::TextInputComponent.new(**text_params).with_content(content), &@block)
    end
  else
     :div do
      concat render(Fluxbit::Form::SelectInputComponent.new(**select_params), &@block)
      concat render(Fluxbit::Form::TextInputComponent.new(**text_params), &@block)
    end
  end
end