7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/zip_search/view_helpers.rb', line 7
def location_search_field(options={})
settings = {
field: {
placeholder: 'Filter by location...',
class: ''
},
form: {
url: request.url,
method: :get,
html: {
class: '',
style: ''
} } }.deep_merge(options)
if params.key?(:location_search) && params[:location_search].key?(:q)
settings[:field][:class] << ' zipsearch-typeahead'
settings[:field][:value] ||= params[:location_search][:q]
end
settings[:form][:html][:class] << ' location-search-form pull-left'
render 'zip_search/locations/search_field', settings: settings
end
|