Class: EacRailsUtils::CommonFormHelper::FormBuilder::SearchableAssociationField

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/eac_rails_utils/common_form_helper/form_builder/searchable_association_field.rb

Instance Method Summary collapse

Constructor Details

#initialize(form_builder, field_name, options) ⇒ SearchableAssociationField

Returns a new instance of SearchableAssociationField.



7
8
9
10
11
# File 'app/helpers/eac_rails_utils/common_form_helper/form_builder/searchable_association_field.rb', line 7

def initialize(form_builder, field_name, options)
  @form_builder = form_builder
  @field_name = field_name
  @options = options
end

Instance Method Details

#hidden_inputObject



13
14
15
# File 'app/helpers/eac_rails_utils/common_form_helper/form_builder/searchable_association_field.rb', line 13

def hidden_input
  @form_builder.form.hidden_field(hidden_input_name, id: hidden_input_id)
end

#javascript_tagObject



22
23
24
25
26
# File 'app/helpers/eac_rails_utils/common_form_helper/form_builder/searchable_association_field.rb', line 22

def javascript_tag
  @form_builder.helper.(:script) do
    @form_builder.helper.raw("new InputSearchable(#{json_options});")
  end
end

#visible_inputObject



17
18
19
20
# File 'app/helpers/eac_rails_utils/common_form_helper/form_builder/searchable_association_field.rb', line 17

def visible_input
  @form_builder.helper.text_field_tag(visible_input_name, '', id: visible_input_id,
                                                              class: 'form-control')
end