Class: MeiMultiLookupInput

Inherits:
MultiValueInput
  • Object
show all
Defined in:
app/inputs/mei_multi_lookup_input.rb

Direct Known Subclasses

LcshLookupInput

Instance Method Summary collapse

Instance Method Details

#build_field_options(value, index) ⇒ Object

Although the ‘index’ parameter is not used in this implementation it is useful in an an overridden version of this method, especially when the field is a complex object and the override defines nested fields.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/inputs/mei_multi_lookup_input.rb', line 21

def build_field_options(value, index)
  options = input_html_options.dup

  options[:value] = value
  if @rendered_first_element
    options[:id] = nil
    options[:required] = nil
  else
    options[:id] ||= input_dom_id
  end
  options[:class] ||= []
  options[:class] += ["#{input_dom_id} form-control multi-text-field"]
  options[:style] ||= []
  options[:style] += ["width:80%"]
  options[:'aria-labelledby'] = label_id
  @rendered_first_element = true

  options
end

#inner_wrapperObject



7
8
9
10
11
12
13
14
15
16
# File 'app/inputs/mei_multi_lookup_input.rb', line 7

def inner_wrapper
  "        <li class=\"field-wrapper\">\n<div class=\"input-group col-sm-12\">\n          \#{yield}\n           <button style=\"width:auto;\" type=\"button\" class=\"btn btn-default\" data-toggle=\"modal\" data-target=\"#meiLookupModal_\#{attribute_name}\">Lookup</button>\n</div>\n        </li>\n  HTML\nend\n"

#input_typeObject

Overriding this so that the class is correct and the javascript for multivalue will work on this.



3
4
5
# File 'app/inputs/mei_multi_lookup_input.rb', line 3

def input_type
  'multi_value'.freeze
end