formatted_form 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.2
1
+ 2.0.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "formatted_form"
8
- s.version = "2.0.2"
8
+ s.version = "2.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jack Neto", "Oleg Khabarov", "The Working Group Inc."]
12
- s.date = "2012-12-10"
12
+ s.date = "2012-12-13"
13
13
  s.description = ""
14
14
  s.email = "jack@twg.ca"
15
15
  s.extra_rdoc_files = [
@@ -35,6 +35,7 @@ class FormattedForm::FormBuilder < ActionView::Helpers::FormBuilder
35
35
  # form.check_box :color, {}, ['red', 'blue']
36
36
  # form.check_box :color, {}, [['Red', 'red'], ['Blue', 'blue']]
37
37
  def check_box(method, options = {}, checked_value = "1", unchecked_value = "0")
38
+ return super(method, options, checked_value, unchecked_value) if options.delete(:builder) == false
38
39
  is_array = checked_value.is_a?(Array)
39
40
  options.merge!(:multiple => true) if is_array
40
41
  checked_value = is_array ? checked_value : [[checked_value, checked_value, unchecked_value]]
@@ -52,6 +53,7 @@ class FormattedForm::FormBuilder < ActionView::Helpers::FormBuilder
52
53
  # form.radio_button :role, ['admin', 'regular']
53
54
  # form.radio_button :role, [['Admin', 1], ['Regular', 0]]
54
55
  def radio_button(method, tag_value, options = {})
56
+ return super(method, tag_value, options) if options.delete(:builder) == false
55
57
  tag_values = tag_value.is_a?(Array) ? tag_value : [tag_value]
56
58
  choices = tag_values.collect do |label, choice|
57
59
  label, choice = label, label if !choice
@@ -95,7 +97,7 @@ protected
95
97
 
96
98
  # Main rendering method
97
99
  def default_field(field_name, method, options = {}, &block)
98
- return yield if options.delete(:builder) == false
100
+ return yield if options.delete(:builder) == false && block_given?
99
101
  builder_options = builder_options!(options)
100
102
  @template.render(
101
103
  :partial => "formatted_form/#{field_name}",
@@ -216,6 +216,13 @@ class FormBuilderTest < ActionView::TestCase
216
216
  end
217
217
  end
218
218
 
219
+ def test_check_box_with_no_builder
220
+ with_check_box :colors, :builder => false
221
+ assert_select "div[class='control-group cg-colors']", 0
222
+ assert_select "label[for='user_colors']", 0
223
+ assert_select "input[builder='false']", 0
224
+ end
225
+
219
226
  # -- Element --------------------------------------------------------------
220
227
  def test_element
221
228
  with_element 'Label', 'Content'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formatted_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-12-10 00:00:00.000000000 Z
14
+ date: 2012-12-13 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -134,7 +134,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
134
134
  version: '0'
135
135
  segments:
136
136
  - 0
137
- hash: 2473177573234554938
137
+ hash: 578154842120635120
138
138
  required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  none: false
140
140
  requirements: