twitter-bootstrap-form-builder 0.0.8 → 0.0.9
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
CHANGED
@@ -88,13 +88,19 @@ If you need to override the text of the label, use `:label`:
|
|
88
88
|
<%= f.text_field :email, :label => "Email Address" %>
|
89
89
|
```
|
90
90
|
|
91
|
-
If you want to turn off the helper entirely and output *just* the
|
92
|
-
the regular `FormBuilder#text_field`, use `:label => false`:
|
91
|
+
If you want to turn off the helper entirely for one field and output *just* the input/select/textarea element,
|
92
|
+
exactly as if you were calling the regular `FormBuilder#text_field`, use `:label => false`:
|
93
93
|
|
94
94
|
```erb
|
95
95
|
<%= f.text_field :email, :label => false %> # <input type="text" id="post_email" />
|
96
96
|
```
|
97
97
|
|
98
|
+
To disable the Bootstrap FormBuilder for an entire form, use `:bootstrap => false` with `form_for`:
|
99
|
+
|
100
|
+
```erb
|
101
|
+
<%= form_for @post, :bootstrap => false do |f| %>
|
102
|
+
```
|
103
|
+
|
98
104
|
To render the field within the Bootstrap control-group markup but without a label tag,
|
99
105
|
use `:label => nil`:
|
100
106
|
|
@@ -2,18 +2,18 @@
|
|
2
2
|
module MNE
|
3
3
|
module TwitterBootstrapFormBuilder
|
4
4
|
module Helper
|
5
|
-
def form_for (
|
6
|
-
|
5
|
+
def form_for (record, options = {}, &proc)
|
6
|
+
return super(record, options, &proc) if options.delete(:bootstrap) === false
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
options[:builder] ||= MNE::TwitterBootstrapFormBuilder::FormBuilder
|
9
|
+
options[:html] ||= {}
|
10
|
+
options[:html][:class] ||= ""
|
11
11
|
|
12
|
-
if !
|
13
|
-
|
12
|
+
if !options[:html][:class].match(/form-(horizontal|vertical)/)
|
13
|
+
options[:html][:class] = ["form-horizontal", options[:html][:class]].join(" ")
|
14
14
|
end
|
15
15
|
|
16
|
-
super
|
16
|
+
super(record, options, &proc)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 9
|
9
|
+
version: 0.0.9
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Matthew Eagar
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-08-
|
17
|
+
date: 2012-08-05 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|