Class: Irelia::FormBuilder

Inherits:
ActionView::Helpers::FormBuilder
  • Object
show all
Defined in:
lib/irelia/form_builder.rb

Instance Method Summary collapse

Instance Method Details

#email_field(method, html_options = {}, &block) ⇒ Object



17
18
19
# File 'lib/irelia/form_builder.rb', line 17

def email_field(method, html_options = {}, &block)
  render_component(:email_field, method, options: options, html_options: html_options, &block)
end

#password_field(method, html_options = {}, &block) ⇒ Object



13
14
15
# File 'lib/irelia/form_builder.rb', line 13

def password_field(method, html_options = {}, &block)
  render_component(:password_field, method, options: options, html_options: html_options, &block)
end

#select(method, choices = nil, options = {}, html_options = {}, &block) ⇒ Object



21
22
23
# File 'lib/irelia/form_builder.rb', line 21

def select(method, choices = nil, options = {}, html_options = {}, &block)
  render_component(:select, method, choices: choices, options: options, html_options: html_options, &block)
end

#submit(value = nil, options = {}) ⇒ Object



25
26
27
28
29
# File 'lib/irelia/form_builder.rb', line 25

def submit(value = nil, options = {})
  component = Irelia::Button::Component.new(type: :submit, html_options: options)
  component.with_content(value) if value
  component.render_in(@template)
end

#text_field(method, html_options = {}, &block) ⇒ Object

[:text_field, :text_area].each do |method_name|

define_method(method_name) do |method, options = {}|
  render_component(method_name, method, options)
end

end



9
10
11
# File 'lib/irelia/form_builder.rb', line 9

def text_field(method, html_options = {}, &block)
  render_component(:text_field, method, options: options, html_options: html_options, &block)
end