generic_form_builder 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3d15b6819643f21171da9a92b9533cc3728604e9
4
- data.tar.gz: c399fa29b69c958c26805970cd2f00573d9a3e35
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MjgxNTYzOGIzNjVkNGUwY2Q4MzA3ZjY4MzZkODY4MTliNTQ3MTRlNA==
5
+ data.tar.gz: !binary |-
6
+ OTM2OGY3MjI1MWE1N2U4MTc4MDliOTk2MTIxMGJkYzUwYWQ0YjU1YQ==
5
7
  SHA512:
6
- metadata.gz: 371523458872f4cca8767d79c8e2aed8c8887b2b76b6c9767ffcba3720fa48394dfbc4bf0abae10320be29177b0258caa4fec267efe5309002d7a1e0882095d5
7
- data.tar.gz: eadaf534d1782229706e15a12d8729e25aecca802fbdb0e1c2f17d3a67f8e5c09a4f4e249f6fe696e09cf6a96b44b5d2c25515b6b0bd0ea6a87d1457edabe76e
8
+ metadata.gz: !binary |-
9
+ YTFjOGJiNTUwZjU5NzYzMzU4ZTRhMWNlOTc4ZGI3NWUwMDI1NzJkYWUxYjY0
10
+ MjJmNzBhYzgyZmQwNzcxYmY4YmIzZWI0ZTJlZjQ3ZTg0ZDM1NGQ2NmM3MTVj
11
+ YTJhMDQyYmFhMjEyYWNmMWUyN2Y1MGFmZThmMGQzNWY0N2IzNWQ=
12
+ data.tar.gz: !binary |-
13
+ OGQzOGQ4NGZhZmJkMzU1NjllMDUxNTVjYTQzY2QyZmFmZjUwNTNlODA4ZGIz
14
+ ODdkN2M4MmNmYjBhYTk5YTU0NTVhMjg5ZGJjZmY1N2JmMTFmZDFiOWEwZWRk
15
+ NGNkZjNjMmMzMjA2MzNjMWU5NzVmOTNiYjBjZjk3NTVhZmMyM2Q=
@@ -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.10.0'
4
+ s.version = '0.11.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"]
@@ -20,11 +20,10 @@ class GenericFormBuilder < ActionView::Helpers::FormBuilder
20
20
  html_options = {}
21
21
 
22
22
  if any_errors?(field)
23
- errors = ' '+content_tag(:span, errors_text(field), :class => "error")
24
23
  html_options.merge!('class' => 'errors')
25
24
  end
26
25
 
27
- content_tag(:p, label(field, "#{options[:label] || field.to_s.humanize}#{errors}".try(:html_safe)) + note + super(field, options, *args) + button.try(:html_safe), html_options)
26
+ content_tag(:p, label(field, "#{options[:label] || field.to_s.humanize} #{errors_text(field)}".try(:html_safe)) + note + super(field, options, *args) + button.try(:html_safe), html_options)
28
27
  end
29
28
  end
30
29
 
@@ -32,28 +31,32 @@ class GenericFormBuilder < ActionView::Helpers::FormBuilder
32
31
  return super if options[:default_builder]
33
32
  label_text = options[:label] || field.to_s.humanize
34
33
  note = note_html(options[:note])
35
- content_tag(:p, label(field, "#{label_text} #{errors_text(field)}") + note + super)
34
+ p_html_options = {}
35
+ if any_errors?(field)
36
+ p_html_options.merge!('class' => 'errors')
37
+ end
38
+ content_tag(:p, label(field, "#{label_text} #{errors_text(field)}".try(:html_safe)) + note + super, p_html_options)
36
39
  end
37
40
 
38
41
  def collection_select(field, collection, value_method, name_method, options = {}, html_options = {})
39
42
  return super(field, collection, value_method, name_method) if options[:default_builder]
40
43
  label_text = options[:label] || field.to_s.humanize
41
44
  note = note_html(options[:note])
42
- content_tag(:p, label(field, "#{label_text} #{errors_text(field)}") + note + super(field, collection, value_method, name_method))
45
+ content_tag(:p, label(field, "#{label_text} #{errors_text(field)}".try(:html_safe)) + note + super(field, collection, value_method, name_method))
43
46
  end
44
47
 
45
48
  def check_box(field, options = {})
46
49
  return super if options[:default_builder]
47
50
  label_text = options[:label] || field.to_s.humanize
48
51
  note = note_html(options[:note])
49
- content_tag(:p, label(field, super + " #{label_text} #{errors_text(field)}" + note, :class => 'checkbox'))
52
+ content_tag(:p, label(field, super + " #{label_text} #{errors_text(field)}".try(:html_safe) + note, :class => 'checkbox'))
50
53
  end
51
54
 
52
55
  def radio_button(field, value, options = {})
53
56
  return super if options[:default_builder]
54
57
  label_text = options.delete(:label) || field.to_s.humanize
55
58
  tag_type = options.delete(:tag_type) || :li
56
- content_tag(tag_type, label("#{field}_#{value.to_s.downcase.gsub(' ', '_')}", super + " #{label_text} #{errors_text(field)}", :class => 'radio', :onclick => ""))
59
+ content_tag(tag_type, label("#{field}_#{value.to_s.downcase.gsub(' ', '_')}", super + " #{label_text} #{errors_text(field)}".try(:html_safe), :class => 'radio', :onclick => ""))
57
60
  end
58
61
 
59
62
  def buttons(options = {})
@@ -71,7 +74,7 @@ protected
71
74
 
72
75
  def errors_text(field)
73
76
  return '' unless any_errors?(field)
74
- @object.errors[field].join(' and ')
77
+ content_tag(:span, @object.errors[field].join(' and '), :class => "error")
75
78
  end
76
79
 
77
80
  def note_html(note)
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.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Crosby-McCullough
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-11-11 00:00:00.000000000 Z
14
+ date: 2015-01-22 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description:
17
17
  email:
@@ -32,17 +32,17 @@ require_paths:
32
32
  - lib
33
33
  required_ruby_version: !ruby/object:Gem::Requirement
34
34
  requirements:
35
- - - ">="
35
+ - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
37
  version: '0'
38
38
  required_rubygems_version: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ">="
40
+ - - ! '>='
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  requirements: []
44
44
  rubyforge_project:
45
- rubygems_version: 2.2.2
45
+ rubygems_version: 2.4.5
46
46
  signing_key:
47
47
  specification_version: 4
48
48
  summary: Generic Rails 3 form builder