Sha256: 55c4b1db3095d18c3a911c3c2bf9e6fb911aef8dc774065c82985323223e112c

Contents?: true

Size: 1.03 KB

Versions: 30

Compression:

Stored size: 1.03 KB

Contents

- # Set variables, f_cached - recod has methods that keeps cached names, f_name - field name or some other name, if there is no 
- # need to store autocomplete field information, f_url - request url for search, f_value - value for autocomplete input,
- # f_options - html options for input are used in js.

- f_cached = field.dbi.klass.respond_to?(:"cached_#{field.name}")
- f_name = f_cached ? "cached_#{field.name}" : "autocomplete-#{resource_name}-#{field.name}"
- f_url = autocomplete_field_path(:field_class => resource_class.to_s, :field_name => field.name)

- f_value = if local_assigns[:with_value]
  - current_form.object.send(field.association.name) && current_form.object.send(field.association.name).send(field.current_text_method(field.association.klass))
- else
  - nil

- f_options = {:autocomplete => "off", :"data-autocomplete-url" => f_url, :"data-macro" => field.association.macro, :"data-cached" => f_cached ? "yes" : "no"}

- if f_cached
  = current_form.text_field f_name, f_options
- else
  = text_field_tag f_name, f_value, f_options

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
lolita-4.0.11 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-4.2.0 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-4.0.10 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-4.0.9 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-4.0.8 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-4.0.7 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-4.0.6 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-4.0.5 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-4.0.4 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-4.0.3 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-4.0.2 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-4.0.1 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-4.0.0 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-3.4.3 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-3.4.2 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-3.4.1 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-3.4.0 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-3.3.9 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-3.3.8 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml
lolita-3.3.7 app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml