generic_form_builder 0.6.0 → 0.7.0

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDYyZWRlZTkwMjcxZmE1ODRiYjFiZDcwMzY1Y2ZmM2RmMzVlN2FmZQ==
4
+ YTQ3MWQ1NjViOTQ2ZGMyZDBhZDJjMmIyYjQyYzFjNGNjZDU2MzEyNQ==
5
5
  data.tar.gz: !binary |-
6
- MGVlNTY1YmM3ZWZjYzY1NTAwN2E2ZDhlYWYzNzc5NTA3NzBkMjA1Zg==
6
+ ZjE4ODYzYTM3NmY2MjJmNTBhZWRiZjlhYjMzMWFjZWZmODAxMWM5OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTIwNDQwODgwYTVlOTJhZmExNjM2ZDUxZWZmOTk1YjI0NTdlZTE3NTEzMWMy
10
- NWM4NThiNjkzNzRmNDZkNzBlZmNhMWZmNTk3Yzg2MWUxMWRjNWU3MDNjZmY0
11
- MGViMjg1MWQ4NDRhZTJkODhmMDkxODQ5NmFkNmM4MzA2YTQ3MzQ=
9
+ ZjM4MWE2ZTMxZTgyNTlmMmI4YTU2MjM2NzFmN2JiMzk5ZGJjZjAzYzcxZGFj
10
+ OTA4MzNmMGU5OTA2YzViYjNkOGU0YTYzNWRjYTQwMzhjNDI1OWU5M2I1ZTIz
11
+ ODhhZWYwMWNmYTVlZThkYTBhMmVjNWM2ZWRlYTcwZjU3ODA4YmI=
12
12
  data.tar.gz: !binary |-
13
- M2QxZDliNDg1ZmE0MWIwYzBkYWZjYTUzNDUzZDJjMGQ1MGI2YjQxNWM5MmNm
14
- NWU3NDIyOWFjNjkwZjlhYmY5YTg0ZjYwN2FlNGY1OTUxMTY0ZjAzYmFjM2Vl
15
- M2IxZjY4MmFlZWMyODY1ZjhhMmYyZGYwMjFmNmZlNWQ3MDNhYjc=
13
+ NGI0M2U1YTc5M2NkMjgzYzNkNTQzM2FmNDhhZDFkYWU4NWYzOTRkNThmODg0
14
+ MThlOWYwODk1ZDQyN2QxNmY1ZjAzNzE1OGY1N2I4ZTJhYzY3MDQxYmNiMGJh
15
+ MWQyMTQwMGUyMmUyMjJlMTUxMDNhYThhNWQwZGFlM2U5NTIyZDE=
data/README.md CHANGED
@@ -1,8 +1,14 @@
1
- Generic form builder
2
- ====================
1
+ # Generic form builder
3
2
 
4
3
  You like, use it. And stuff.
5
4
 
6
5
  Instead of the normal one.
7
6
 
8
7
  I dunno shut up go away stop asking questions.
8
+
9
+ ## Subclassing
10
+
11
+ This is a "generic" form builder because it covers most cases and is a starting point for domain specific form needs.
12
+
13
+ If there's something missing that you think might be relevant to the wider world by all means put in a pull request,
14
+ otherwise subclass the generic builder with your own domain specific additions.
@@ -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.6.0'
4
+ s.version = '0.7.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,8 +15,15 @@ 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 = ' '+errors_text(field) if any_errors?(field)
19
- content_tag(:p, label(field, "#{options[:label] || field.to_s.humanize}#{errors}") + note + super(field, options, *args) + button.try(:html_safe))
18
+
19
+ html_options = {}
20
+
21
+ if any_errors?(field)
22
+ errors = ' '+errors_text(field)
23
+ html_options.merge!('class' => 'errors')
24
+ end
25
+
26
+ content_tag(:p, label(field, "#{options[:label] || field.to_s.humanize}#{errors}") + note + super(field, options, *args) + button.try(:html_safe), html_options)
20
27
  end
21
28
  end
22
29
 
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.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Crosby-McCullough