Module: AbstractInterface::FormBuilders::AbstractFormBuilder

Included in:
ThemedFormBuilder, ThemedFormTagBuilder
Defined in:
lib/abstract_interface/form_builders/abstract_form_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object

text_field_tag, … xxx_tag



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/abstract_interface/form_builders/abstract_form_builder.rb', line 24

def method_missing name, *args, &block
  options = args.extract_options!.symbolize_keys
  args << options

  inject_styles! options, name

  input = @template.send name, *args, &block

  remove_styles! options

  custom_helper input, options, name, options[:object], *args
end

Instance Attribute Details

#templateObject (readonly)

Returns the value of attribute template.



5
6
7
# File 'lib/abstract_interface/form_builders/abstract_form_builder.rb', line 5

def template
  @template
end

Instance Method Details

#error_messages(*errors) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/abstract_interface/form_builders/abstract_form_builder.rb', line 37

def error_messages *errors
  if errors.size == 1 and errors.first.is_a?(Array)
    custom_error_messages *errors
  else
    custom_error_messages errors
  end
end

#field_tag(html, options = {}) ⇒ Object



45
46
47
# File 'lib/abstract_interface/form_builders/abstract_form_builder.rb', line 45

def field_tag html, options = {}
  custom_helper html, options, nil, options[:object]
end

#line(*items) ⇒ Object



7
8
9
# File 'lib/abstract_interface/form_builders/abstract_form_builder.rb', line 7

def line *items
  template.render :partial => template.themed_partial('forms/line'), :object => {:items => items, :delimiter => false}.to_openobject
end

#line_with_delimiters(*items) ⇒ Object

def hidden_field_tag *args

result[:hidden_fields] << @template.hidden_field_tag(*args)

end



19
20
21
# File 'lib/abstract_interface/form_builders/abstract_form_builder.rb', line 19

def line_with_delimiters *items
  template.render :partial => template.themed_partial('forms/line'), :object => {:items => items, :delimiter => true}.to_openobject
end

#submit(*args) ⇒ Object



11
12
13
# File 'lib/abstract_interface/form_builders/abstract_form_builder.rb', line 11

def submit *args
  @template.submit_tag *args
end