7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/stimulus_plumbers/form/fields/search.rb', line 7
def search_field(attribute, options = {})
rails_opts, form_field_opts = (options)
clearable = form_field_opts.delete(:clearable) { false }
field = build_field(attribute, form_field_opts)
html_opts = merge_html_options(
rails_opts,
field_theme(:form_input, error: field.error?),
field.html_opts
)
input_html = if clearable
build_input_group(super(attribute, html_opts), field, trailing: clear_button)
else
super(attribute, html_opts)
end
render_field(field, input_html)
end
|