Class: Grapple::Components::SearchForm

Inherits:
HtmlComponent show all
Defined in:
lib/grapple/components/search_form.rb

Instance Attribute Summary

Attributes inherited from BaseComponent

#builder, #columns, #params, #records, #template

Instance Method Summary collapse

Methods inherited from BaseComponent

#initialize, setting

Constructor Details

This class inherits a constructor from Grapple::Components::BaseComponent

Instance Method Details

#render(*options, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/grapple/components/search_form.rb', line 9

def render(*options, &block)
  options = options[0] ? options[0] : {}
  form_classes = [form_class]
  form_path = options[:form_path] || {}
  form_options = options[:form_options] || {}
  form_options[:class] = form_classes.join(' ')

  html = ''
  html << template.form_tag(form_path, form_options)
  html << template.hidden_field_tag(page_param, 1)
  # TODO: don't use tables for vertical alignment

  html << '<table><tr>'
  render_components(components, options, &block).each do |c|
    html << "<td>#{c}</td>\n"
  end
  html << '</tr></table>'
  html << '</form>'
  html.html_safe
end