Class: Form

Inherits:
Erector::Widget show all
Defined in:
lib/erector/widgets/form.rb

Overview

todo: make more like github.com/justinfrench/formtastic

Instance Method Summary collapse

Methods included from Erector::Sass

#sass

Methods included from Erector::AfterInitialize

included, #initialize

Methods included from Erector::JQuery

#jquery, #jquery_load, #jquery_ready

Methods included from Erector::Convenience

#css, #dom_id, #join, #to_pretty, #to_text, #url

Methods included from Erector::Externals

included, #render_externals, #render_with_externals

Methods included from Erector::Caching

#_render, #_render_via, #cache, included, #should_cache?

Methods included from Erector::Needs

included, #initialize

Methods included from Erector::HTML

#character, #close_tag, #comment, #element, #element!, #empty_element, #h, included, #instruct, #javascript, #nbsp, #open_tag, #raw, #text, #text!

Methods inherited from Erector::AbstractWidget

#call_block, #capture, #initialize, inline, prettyprint_default, #prettyprint_default, prettyprint_default=, #to_a, #to_html, #to_s, #widget

Instance Method Details

#contentObject



6
7
8
9
10
11
12
13
# File 'lib/erector/widgets/form.rb', line 6

def content
  form :method => form_method, :action => @action do
    unless rest_method == form_method
      input :type => "hidden", :name => "_method", :value => rest_method
    end
    super
  end
end

#form_methodObject



19
20
21
22
23
24
25
# File 'lib/erector/widgets/form.rb', line 19

def form_method
  if method == "get"
    "get"
  else
    "post"
  end
end

#methodObject



15
16
17
# File 'lib/erector/widgets/form.rb', line 15

def method
  @method.to_s.downcase
end

#rest_methodObject



27
28
29
# File 'lib/erector/widgets/form.rb', line 27

def rest_method
  method
end