formal 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +52 -11
- data/formal.gemspec +1 -1
- data/lib/formal/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Formal
|
2
2
|
|
3
|
-
|
3
|
+
Formal is simply a form builder that provides the markup we typically use
|
4
|
+
around form fields on Hashrocket projects.
|
4
5
|
|
5
6
|
## Installation
|
6
7
|
|
@@ -18,22 +19,62 @@ Or install it yourself as:
|
|
18
19
|
|
19
20
|
## Usage
|
20
21
|
|
21
|
-
|
22
22
|
Specify the builder option in your form_for parameters
|
23
23
|
|
24
|
+
```ruby
|
25
|
+
= form_for post, builder: Formal::Builder do |f|
|
26
|
+
```
|
27
|
+
|
28
|
+
|
29
|
+
```f.label``` gets wrapped in a ```<dt>``` or a ```<dt class="error">```(wherethere is an error)
|
30
|
+
|
31
|
+
|
32
|
+
The following get wrapped in a ```<dd>``` or a ```<dd class="error">```:
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
f.text_field
|
36
|
+
f.password_field
|
37
|
+
f.text_area
|
38
|
+
f.select
|
39
|
+
f.email_field
|
40
|
+
f.search_field
|
24
41
|
```
|
25
|
-
|
42
|
+
|
43
|
+
__Example:__
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
f.text_field :body
|
26
47
|
```
|
27
48
|
|
28
|
-
|
49
|
+
returns
|
50
|
+
|
51
|
+
```HTML
|
52
|
+
<dd>
|
53
|
+
<input type="text" id="post_body" name="post[body]" />
|
54
|
+
</dd>
|
55
|
+
```
|
56
|
+
|
57
|
+
Also provided is a helper for a label with a checkbox __inside__ it (which is
|
58
|
+
also wrapped in a ```<dt>```). Use:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
f.checkbox_with_label :published
|
62
|
+
```
|
63
|
+
|
64
|
+
which returns:
|
65
|
+
|
66
|
+
```html
|
67
|
+
<dt>
|
68
|
+
<label for="post_published">
|
69
|
+
<input name="post[published]" type="hidden" value="0" />
|
70
|
+
<input id="post_published" name="post[published]" type="checkbox" value="1" />
|
71
|
+
published
|
72
|
+
</label>
|
73
|
+
</dt>
|
74
|
+
```
|
75
|
+
|
76
|
+
|
29
77
|
|
30
|
-
- label_tag
|
31
|
-
- text_field
|
32
|
-
- password_field
|
33
|
-
- text_area
|
34
|
-
- select
|
35
|
-
- email_field
|
36
|
-
- search_field
|
37
78
|
|
38
79
|
|
39
80
|
## Contributing
|
data/formal.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = [""]
|
7
7
|
gem.description = %q{Helpful form builder used by Rocketeers}
|
8
8
|
gem.summary = %q{A form builder that wraps form fields the way we like it at Hashrocket}
|
9
|
-
gem.homepage = "
|
9
|
+
gem.homepage = ""
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
12
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/lib/formal/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-09-
|
13
|
+
date: 2012-09-27 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: Helpful form builder used by Rocketeers
|
16
16
|
email:
|
@@ -27,7 +27,7 @@ files:
|
|
27
27
|
- formal.gemspec
|
28
28
|
- lib/formal.rb
|
29
29
|
- lib/formal/version.rb
|
30
|
-
homepage:
|
30
|
+
homepage: ''
|
31
31
|
licenses: []
|
32
32
|
post_install_message:
|
33
33
|
rdoc_options: []
|