generic_form_builder 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/generic_form_builder.gemspec +1 -1
- data/lib/generic_form_builder.rb +5 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDYyZWRlZTkwMjcxZmE1ODRiYjFiZDcwMzY1Y2ZmM2RmMzVlN2FmZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MGVlNTY1YmM3ZWZjYzY1NTAwN2E2ZDhlYWYzNzc5NTA3NzBkMjA1Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTIwNDQwODgwYTVlOTJhZmExNjM2ZDUxZWZmOTk1YjI0NTdlZTE3NTEzMWMy
|
10
|
+
NWM4NThiNjkzNzRmNDZkNzBlZmNhMWZmNTk3Yzg2MWUxMWRjNWU3MDNjZmY0
|
11
|
+
MGViMjg1MWQ4NDRhZTJkODhmMDkxODQ5NmFkNmM4MzA2YTQ3MzQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
M2QxZDliNDg1ZmE0MWIwYzBkYWZjYTUzNDUzZDJjMGQ1MGI2YjQxNWM5MmNm
|
14
|
+
NWU3NDIyOWFjNjkwZjlhYmY5YTg0ZjYwN2FlNGY1OTUxMTY0ZjAzYmFjM2Vl
|
15
|
+
M2IxZjY4MmFlZWMyODY1ZjhhMmYyZGYwMjFmNmZlNWQ3MDNhYjc=
|
@@ -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
|
+
s.version = '0.6.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"]
|
data/lib/generic_form_builder.rb
CHANGED
@@ -15,7 +15,7 @@ class GenericFormBuilder < ActionView::Helpers::FormBuilder
|
|
15
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
|
-
errors = ' '
|
18
|
+
errors = ' '+errors_text(field) if any_errors?(field)
|
19
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
|
@@ -56,6 +56,10 @@ class GenericFormBuilder < ActionView::Helpers::FormBuilder
|
|
56
56
|
|
57
57
|
protected
|
58
58
|
|
59
|
+
def any_errors?(field)
|
60
|
+
@object and @object.errors and @object.errors[field] and @object.errors[field].any?
|
61
|
+
end
|
62
|
+
|
59
63
|
def errors_text(field)
|
60
64
|
return '' if @object.errors[field].empty?
|
61
65
|
@object.errors[field].join(' and ')
|