formtastic 1.0.0.beta4 → 1.0.0.rc
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/lib/formtastic.rb +3 -1
- data/spec/inputs/boolean_input_spec.rb +1 -1
- metadata +3 -3
data/lib/formtastic.rb
CHANGED
@@ -1205,9 +1205,11 @@ module Formtastic #:nodoc:
|
|
1205
1205
|
html_options = options.delete(:input_html) || {}
|
1206
1206
|
checked = options.key?(:checked) ? options[:checked] : options[:selected]
|
1207
1207
|
html_options[:checked] = checked == true if [:selected, :checked].any? { |k| options.key?(k) }
|
1208
|
+
checked_value = options.delete(:checked_value) || '1'
|
1209
|
+
unchecked_value = options.delete(:unchecked_value) || '0'
|
1208
1210
|
|
1209
1211
|
input = self.check_box(method, strip_formtastic_options(options).merge(html_options),
|
1210
|
-
|
1212
|
+
checked_value, unchecked_value)
|
1211
1213
|
options = options_for_label(options)
|
1212
1214
|
|
1213
1215
|
# the label() method will insert this nested input into the label at the last minute
|
@@ -38,7 +38,7 @@ describe 'boolean input' do
|
|
38
38
|
concat(builder.input(:allow_comments, :as => :boolean, :checked_value => 'checked', :unchecked_value => 'unchecked'))
|
39
39
|
end
|
40
40
|
|
41
|
-
output_buffer.should have_tag('form li label input[@type="checkbox"][@value="checked"]')
|
41
|
+
output_buffer.should have_tag('form li label input[@type="checkbox"][@value="checked"]:not([@unchecked_value][@checked_value])')
|
42
42
|
output_buffer.should have_tag('form li label input[@type="hidden"][@value="unchecked"]')
|
43
43
|
end
|
44
44
|
|
metadata
CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
|
|
6
6
|
- 1
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.0.
|
9
|
+
- rc
|
10
|
+
version: 1.0.0.rc
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Justin French
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-08-01 00:00:00 +10:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|