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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YmVjNmQ2YTE0ODRlN2MxMTM4ZTU3Y2U0MWM4ZjM2MTI4MjI0NDhkMg==
4
+ NDYyZWRlZTkwMjcxZmE1ODRiYjFiZDcwMzY1Y2ZmM2RmMzVlN2FmZQ==
5
5
  data.tar.gz: !binary |-
6
- ODM2ZmJkNGUyYTgwMzE5N2NkNDgzMmFmOTNkMDMxZjk2YzA2MjJhYg==
6
+ MGVlNTY1YmM3ZWZjYzY1NTAwN2E2ZDhlYWYzNzc5NTA3NzBkMjA1Zg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDJiOWVmMTU0Y2QyMmY2OTkxYzIxY2I4YmY5ODBkNjljN2QwOWE3NzM0NTI4
10
- NzNmZTFmMDY3OTMxYTZjZWEzYTA0ZDI4Y2E1NDFkYTIxODI3YmU0OGVlZmRj
11
- MmFiNDg2NDczYWE5YWI4NGNlNzQ5YjZkOTVmMzM5NjFmMGYwOTI=
9
+ YTIwNDQwODgwYTVlOTJhZmExNjM2ZDUxZWZmOTk1YjI0NTdlZTE3NTEzMWMy
10
+ NWM4NThiNjkzNzRmNDZkNzBlZmNhMWZmNTk3Yzg2MWUxMWRjNWU3MDNjZmY0
11
+ MGViMjg1MWQ4NDRhZTJkODhmMDkxODQ5NmFkNmM4MzA2YTQ3MzQ=
12
12
  data.tar.gz: !binary |-
13
- MjUxM2VjMmU5NGMwNGVkODM3OTc5NjFmMzg3ODg3ODUwZmU5MGEwZWVlYzRk
14
- Y2E2MDZkOTIzMzIwODE5YWVhZjU0NTIyZDI0MTE2NzRmNDNiYjNhOGRjNmNi
15
- YzcxMDk3OWExZTk0MGViNDczOTc4ZDg2YjdiMTk3ZDYwNDNmNzc=
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.5.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"]
@@ -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 = ' '+@object.errors[field].join(' and ') if @object.errors[field].any?
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 ')
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.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Crosby-McCullough