Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 48 lines (33 sloc) 1.487 kb
7fa300f Jeremy Evans Initial WIP
authored
1 = Forme
2
3 Forme is a HTML forms library for ruby with the following goals:
4
5 1) Have no external dependencies
6 2) Have a simple API
7 3) Support forms both with and without related objects
8375d6b Jeremy Evans Massive refactoring, completely new API
authored
8 4) Allow compiling down to different types of output, by using
7fa300f Jeremy Evans Initial WIP
authored
9 an intermediate abstract syntax tree, similar to Sequel
10
8375d6b Jeremy Evans Massive refactoring, completely new API
authored
11 = Basic Usage
7fa300f Jeremy Evans Initial WIP
authored
12
8375d6b Jeremy Evans Massive refactoring, completely new API
authored
13 Without an object, is a simple form builder:
14
15 f = Forme::Form.new
16 f.open(:action=>'/foo', :method=>:post) # '<form action="/foo" method="post">
17 f.input(:textarea, :value=>'foo', :name=>'bar') # '<textarea name="bar">foo</textarea>'
18 f.input(:text, :value=>'foo', :name=>'bar') # '<input name="bar" type="text" value="foo"/>'
19 f.close # '</form>'
20
21 With an object, calls +forme_input+ on the obj with the form, field, and options, which
22 should return a <tt>Forme::Input</tt> instance.
23
24 f = Forme::Form.new(obj)
25 # obj.forme_input(f, :field, opts)
26 # => Forme::Input.new(f, :text, :name=>'obj[field]', :id=>'obj_field', :value=>'foo')
27 f.input(:field) # '<input id="obj_field" name="obj[field]" type="text" value="foo"/>'
28
29 = Main Classes
30
31 <tt>Forme::Form</tt> :: main object
32 <tt>Forme::Input</tt> :: high level abstract tag
33 <tt>Forme::Tag</tt> :: low level abstract tag
34 <tt>Forme::Formatter</tt> :: takes input, returns tag
35 <tt>Forme::Serializer</tt> :: tags tag, returns string
36
37 = Other Similar Projects
38
39 All of these have external dependencies:
40
41 1) Rails built-in helpers
42 2) Formtastic
43 3) padrino-helpers
7fa300f Jeremy Evans Initial WIP
authored
44
45 = Author
46
47 Jeremy Evans <code@jeremyevans.net>
Something went wrong with that request. Please try again.