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 +8 -8
- data/README.md +8 -2
- data/generic_form_builder.gemspec +1 -1
- data/lib/generic_form_builder.rb +9 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTQ3MWQ1NjViOTQ2ZGMyZDBhZDJjMmIyYjQyYzFjNGNjZDU2MzEyNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjE4ODYzYTM3NmY2MjJmNTBhZWRiZjlhYjMzMWFjZWZmODAxMWM5OA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjM4MWE2ZTMxZTgyNTlmMmI4YTU2MjM2NzFmN2JiMzk5ZGJjZjAzYzcxZGFj
|
10
|
+
OTA4MzNmMGU5OTA2YzViYjNkOGU0YTYzNWRjYTQwMzhjNDI1OWU5M2I1ZTIz
|
11
|
+
ODhhZWYwMWNmYTVlZThkYTBhMmVjNWM2ZWRlYTcwZjU3ODA4YmI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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.
|
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"]
|
data/lib/generic_form_builder.rb
CHANGED
@@ -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
|
-
|
19
|
-
|
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
|
|