14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/bolter/helpers.rb', line 14
def search_form(url, options = {}, &block)
raise ArgumentError, 'Missing block' unless block_given?
as = options.fetch(:as, :search)
object = OpenStruct.new(params[as])
builder = ActionView::Base.default_form_builder.new(as, object, self, options)
html_options = options.fetch(:html, {})
html_options[:data] = options.delete(:data)
html_options[:remote] = options.fetch(:remote, false)
html_options[:method] = options.fetch(:method, :get)
html_options[:enforce_utf8] = options.fetch(:enforce_utf8, nil)
html_options[:authenticity_token] = options.delete(:authenticity_token)
html_options = html_options_for_form(url, html_options)
output = form_tag_html(html_options)
output << capture(builder, &block)
output.safe_concat('</form>')
end
|