generic_form_builder 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = "generic_form_builder"
4
- s.version = '0.3.0'
4
+ s.version = '0.4.0'
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.authors = ["Elliot Crosby-McCullough", "George Brocklehurst", "Elise Huard", "Tom Stuart"]
7
7
  s.email = ["elliot.cm@gmail.com"]
@@ -11,6 +11,7 @@ class GenericFormBuilder < ActionView::Helpers::FormBuilder
11
11
  ].each do |method|
12
12
  define_method(method.to_sym) do |field, *args|
13
13
  options, *args = args
14
+ return super(field, *args) if options && options[:default_builder]
14
15
  options ||= {:label => field.to_s.humanize}
15
16
  note = content_tag(:span, options[:note], :class => 'note') if options[:note]
16
17
  button = ' '+content_tag(:button, content_tag(:span, options[:button])) if options[:button]
@@ -20,21 +21,25 @@ class GenericFormBuilder < ActionView::Helpers::FormBuilder
20
21
  end
21
22
 
22
23
  def select(field, collection, options = {}, html_options = {})
24
+ return super if options[:default_builder]
23
25
  label_text = options[:label] || field.to_s.humanize
24
26
  content_tag(:p, label(field, "#{label_text} #{errors_text(field)}") + super)
25
27
  end
26
28
 
27
29
  def collection_select(field, collection, value_method, name_method, options = {}, html_options = {})
30
+ return super(field, collection, value_method, name_method) if options[:default_builder]
28
31
  label_text = options[:label] || field.to_s.humanize
29
32
  content_tag(:p, label(field, "#{label_text} #{errors_text(field)}") + super(field, collection, value_method, name_method))
30
33
  end
31
34
 
32
35
  def check_box(field, options = {})
36
+ return super if options[:default_builder]
33
37
  label_text = options[:label] || field.to_s.humanize
34
38
  content_tag(:p, label(field, super + " #{label_text} #{errors_text(field)}", :class => 'checkbox'))
35
39
  end
36
40
 
37
41
  def radio_button(field, value, options = {})
42
+ return super if options[:default_builder]
38
43
  label_text = options.delete(:label) || field.to_s.humanize
39
44
  options[:tag_type] ||= :li
40
45
  content_tag(options[:tag_type], label(field, super + " #{label_text} #{errors_text(field)}"))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: generic_form_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-03-08 00:00:00.000000000Z
15
+ date: 2012-03-14 00:00:00.000000000Z
16
16
  dependencies: []
17
17
  description:
18
18
  email: