twitter_bootstrap_form_for 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +20 -5
- data/LICENSE.markdown +22 -0
- data/README.markdown +1 -1
- data/lib/twitter_bootstrap_form_for/form_builder.rb +11 -10
- data/lib/twitter_bootstrap_form_for/version.rb +1 -1
- metadata +35 -61
data/CHANGELOG.markdown
CHANGED
@@ -1,14 +1,20 @@
|
|
1
1
|
Twitter Bootstrap Form For Changes
|
2
2
|
==================================
|
3
3
|
|
4
|
+
## 1.0.3 (2011-11-11) ##
|
5
|
+
- ruby 1.8 compatibility for hidden fields (closes [\#20])
|
6
|
+
- produce correct labels for radio buttons (closes [\#16])
|
7
|
+
- add support for HTML options to #inputs (closes [\#18])
|
8
|
+
- explicitly license as MIT (closes [\#17])
|
9
|
+
|
4
10
|
## 1.0.2 (2011-10-31) ##
|
5
11
|
- dependencies reduced to just `railties` and `actionpack`
|
6
|
-
- 1.8.7 compatibility fixes
|
7
|
-
- added compatibility with non-ActiveModel objects
|
12
|
+
- 1.8.7 compatibility fixes (closes [\#14])
|
13
|
+
- added compatibility with non-ActiveModel objects (closes [\#7])
|
8
14
|
- demonstrated use of radio buttons in the README
|
9
15
|
|
10
16
|
## 1.0.1 (2011-10-06) ##
|
11
|
-
- hidden_field tags are no longer accidentally marked-up (
|
17
|
+
- hidden_field tags are no longer accidentally marked-up (closes [\#5])
|
12
18
|
|
13
19
|
## 1.0.0 (2011-10-04) ##
|
14
20
|
- added a changelog
|
@@ -17,8 +23,17 @@ Twitter Bootstrap Form For Changes
|
|
17
23
|
## 1.0.0.rc2 (2011-10-04) ##
|
18
24
|
- removed dependency on Haml
|
19
25
|
- checkbox text is now part of the label
|
20
|
-
- prevent `field_with_errors` divs from wrapping inputs and labels (
|
21
|
-
|
26
|
+
- prevent `field_with_errors` divs from wrapping inputs and labels (closes
|
27
|
+
[\#1])
|
22
28
|
|
23
29
|
## 1.0.0.rc1 (2011-09-30) ##
|
24
30
|
- initial public release
|
31
|
+
|
32
|
+
[\#20]: https://github.com/stouset/twitter_bootstrap_form_for/issues/20
|
33
|
+
[\#18]: https://github.com/stouset/twitter_bootstrap_form_for/issues/18
|
34
|
+
[\#17]: https://github.com/stouset/twitter_bootstrap_form_for/issues/17
|
35
|
+
[\#16]: https://github.com/stouset/twitter_bootstrap_form_for/issues/16
|
36
|
+
[\#14]: https://github.com/stouset/twitter_bootstrap_form_for/issues/14
|
37
|
+
[\#7]: https://github.com/stouset/twitter_bootstrap_form_for/issues/7
|
38
|
+
[\#5]: https://github.com/stouset/twitter_bootstrap_form_for/issues/5
|
39
|
+
[\#1]: https://github.com/stouset/twitter_bootstrap_form_for/issues/1
|
data/LICENSE.markdown
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License
|
2
|
+
===============
|
3
|
+
|
4
|
+
Copyright (C) 2011 by Stephen Touset
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
data/README.markdown
CHANGED
@@ -21,7 +21,7 @@ Just Rails. But you were going to use that anyway, weren't you?
|
|
21
21
|
= twitter_bootstrap_form_for @user do |user|
|
22
22
|
|
23
23
|
/ wraps a section in a fieldset with the provided legend text
|
24
|
-
= user.inputs 'Sign up' do
|
24
|
+
= user.inputs 'Sign up', :class => 'sign_up' do
|
25
25
|
|
26
26
|
/ generates a standard email field
|
27
27
|
= user.email_field :email, :placeholder => 'me@example.com'
|
@@ -2,8 +2,6 @@ require 'twitter_bootstrap_form_for'
|
|
2
2
|
require 'action_view/helpers'
|
3
3
|
|
4
4
|
class TwitterBootstrapFormFor::FormBuilder < ActionView::Helpers::FormBuilder
|
5
|
-
# TODO: support inline inputs
|
6
|
-
|
7
5
|
include TwitterBootstrapFormFor::FormHelpers
|
8
6
|
|
9
7
|
attr_reader :template
|
@@ -14,7 +12,7 @@ class TwitterBootstrapFormFor::FormBuilder < ActionView::Helpers::FormBuilder
|
|
14
12
|
:select,
|
15
13
|
*ActionView::Helpers::FormBuilder.instance_methods.grep(%r{
|
16
14
|
_(area|field|select)$ # all area, field, and select methods
|
17
|
-
}mx)
|
15
|
+
}mx).map(&:to_sym)
|
18
16
|
]
|
19
17
|
|
20
18
|
INPUTS.delete(:hidden_field)
|
@@ -28,12 +26,12 @@ class TwitterBootstrapFormFor::FormBuilder < ActionView::Helpers::FormBuilder
|
|
28
26
|
# Wraps the contents of the block passed in a fieldset with optional
|
29
27
|
# +legend+ text.
|
30
28
|
#
|
31
|
-
def inputs(legend = nil, &block)
|
29
|
+
def inputs(legend = nil, options = {}, &block)
|
32
30
|
# stash the old field_error_proc, then override it temporarily
|
33
31
|
original_field_error_proc = template.field_error_proc
|
34
32
|
template.field_error_proc = lambda {|html_tag, instance| html_tag }
|
35
33
|
|
36
|
-
template.content_tag(:fieldset) do
|
34
|
+
template.content_tag(:fieldset, options) do
|
37
35
|
template.concat template.content_tag(:legend, legend) unless legend.nil?
|
38
36
|
block.call
|
39
37
|
end
|
@@ -92,11 +90,12 @@ class TwitterBootstrapFormFor::FormBuilder < ActionView::Helpers::FormBuilder
|
|
92
90
|
|
93
91
|
TOGGLES.each do |toggle|
|
94
92
|
define_method toggle do |attribute, *args, &block|
|
95
|
-
label
|
96
|
-
target
|
93
|
+
label = args.first.nil? ? '' : args.shift
|
94
|
+
target = self.object_name.to_s + '_' + attribute.to_s
|
95
|
+
label_attrs = toggle == :check_box ? { :for => target } : {}
|
97
96
|
|
98
97
|
template.content_tag(:li) do
|
99
|
-
template.concat template.content_tag(:label,
|
98
|
+
template.concat template.content_tag(:label, label_attrs) {
|
100
99
|
template.concat super(attribute, *args)
|
101
100
|
template.concat ' ' # give the input and span some room
|
102
101
|
template.concat template.content_tag(:span, label)
|
@@ -105,6 +104,8 @@ class TwitterBootstrapFormFor::FormBuilder < ActionView::Helpers::FormBuilder
|
|
105
104
|
end
|
106
105
|
end
|
107
106
|
|
107
|
+
protected
|
108
|
+
|
108
109
|
#
|
109
110
|
# Wraps the contents of +block+ inside a +tag+ with an appropriate class and
|
110
111
|
# id for the object's +attribute+. HTML options can be overridden by passing
|
@@ -154,8 +155,8 @@ class TwitterBootstrapFormFor::FormBuilder < ActionView::Helpers::FormBuilder
|
|
154
155
|
# This merges any +classes+ passed in.
|
155
156
|
#
|
156
157
|
def _wrapper_classes(attribute, *classes)
|
157
|
-
classes.tap do |
|
158
|
-
|
158
|
+
classes.tap do |klasses|
|
159
|
+
klasses.push 'error' if self.errors_on?(attribute)
|
159
160
|
end.join(' ')
|
160
161
|
end
|
161
162
|
|
metadata
CHANGED
@@ -1,62 +1,47 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter_bootstrap_form_for
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 1.0.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Stephen Touset
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-11-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: railties
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70157112743780 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
18
|
+
requirements:
|
27
19
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 3
|
32
|
-
version: "3"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3'
|
33
22
|
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: actionpack
|
37
23
|
prerelease: false
|
38
|
-
|
24
|
+
version_requirements: *70157112743780
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: actionpack
|
27
|
+
requirement: &70157112743200 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
|
-
requirements:
|
29
|
+
requirements:
|
41
30
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 3
|
46
|
-
version: "3"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3'
|
47
33
|
type: :runtime
|
48
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70157112743200
|
49
36
|
description: A custom Rails FormBuilder that assumes the use of Twitter Bootstrap
|
50
|
-
email:
|
37
|
+
email:
|
51
38
|
- stephen@touset.org
|
52
39
|
executables: []
|
53
|
-
|
54
40
|
extensions: []
|
55
|
-
|
56
41
|
extra_rdoc_files: []
|
57
|
-
|
58
|
-
files:
|
42
|
+
files:
|
59
43
|
- CHANGELOG.markdown
|
44
|
+
- LICENSE.markdown
|
60
45
|
- README.markdown
|
61
46
|
- examples/screenshot.png
|
62
47
|
- lib/twitter_bootstrap_form_for.rb
|
@@ -65,39 +50,28 @@ files:
|
|
65
50
|
- lib/twitter_bootstrap_form_for/railtie.rb
|
66
51
|
- lib/twitter_bootstrap_form_for/version.rb
|
67
52
|
- twitter_bootstrap_form_for.gemspec
|
68
|
-
has_rdoc: true
|
69
53
|
homepage: http://github.com/stouset/twitter_bootstrap_form_for
|
70
54
|
licenses: []
|
71
|
-
|
72
55
|
post_install_message:
|
73
56
|
rdoc_options: []
|
74
|
-
|
75
|
-
require_paths:
|
57
|
+
require_paths:
|
76
58
|
- lib
|
77
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
60
|
none: false
|
79
|
-
requirements:
|
80
|
-
- -
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
|
83
|
-
|
84
|
-
- 0
|
85
|
-
version: "0"
|
86
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
66
|
none: false
|
88
|
-
requirements:
|
89
|
-
- -
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
|
92
|
-
segments:
|
93
|
-
- 0
|
94
|
-
version: "0"
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
95
71
|
requirements: []
|
96
|
-
|
97
72
|
rubyforge_project:
|
98
|
-
rubygems_version: 1.
|
73
|
+
rubygems_version: 1.8.11
|
99
74
|
signing_key:
|
100
75
|
specification_version: 3
|
101
76
|
summary: Rails form builder optimized for Twitter Bootstrap
|
102
77
|
test_files: []
|
103
|
-
|