generic_form_builder 0.4.0 → 0.4.1
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/generic_form_builder.gemspec +1 -1
- data/lib/generic_form_builder.rb +3 -3
- metadata +2 -2
@@ -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.4.
|
4
|
+
s.version = '0.4.1'
|
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"]
|
data/lib/generic_form_builder.rb
CHANGED
@@ -11,12 +11,12 @@ 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
|
-
|
15
|
-
|
14
|
+
options ||= {}
|
15
|
+
return super(field, *args) if options[:default_builder]
|
16
16
|
note = content_tag(:span, options[:note], :class => 'note') if options[:note]
|
17
17
|
button = ' '+content_tag(:button, content_tag(:span, options[:button])) if options[:button]
|
18
18
|
errors = ' '+@object.errors[field].join(' and ') if @object.errors[field].any?
|
19
|
-
content_tag(:p, label(field, "#{options[:label]}#{errors}") + note + super(field, options, *args) + button.try(:html_safe))
|
19
|
+
content_tag(:p, label(field, "#{options[:label] || field.to_s.humanize}#{errors}") + note + super(field, options, *args) + button.try(:html_safe))
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
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.4.
|
4
|
+
version: 0.4.1
|
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-
|
15
|
+
date: 2012-03-19 00:00:00.000000000Z
|
16
16
|
dependencies: []
|
17
17
|
description:
|
18
18
|
email:
|