generic_form_builder 0.9.0 → 0.10.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 +5 -13
- data/generic_form_builder.gemspec +1 -1
- data/lib/generic_form_builder.rb +18 -4
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YWQ4YWVjZmVjZWYwNmIzYWEzYmE2NGIwMTI4ODYyYTQyOTBkODQ2OQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3d15b6819643f21171da9a92b9533cc3728604e9
|
4
|
+
data.tar.gz: c399fa29b69c958c26805970cd2f00573d9a3e35
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZmU5ZDYxNjc4ZDAxOTQ0ZDE1NDM5ZTU2YTBjMjFhYzFiMWE1NTZiMWJmN2Uy
|
11
|
-
MDJlYmUzZTE3Njk2YzExYjMwZTY2ZWU1ZDgyZWYyYWVjYTFmNDU=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
N2JjYzhjNTcwY2YzM2UzYzAwMTIwZGVlMjlkMDRjYzJkNmM5MzU5Y2QzZmJk
|
14
|
-
YzVjZTEzMzdkYWJkMTFlNTg5ZjVjNjAyYzcyYzcyMTA0YjE0NGFmYWVkOTY3
|
15
|
-
MmE1ZWY4NzBlM2Q2NDQ5Y2JhOTcwZWJhNDY5ZDBlYjk3M2VlNTI=
|
6
|
+
metadata.gz: 371523458872f4cca8767d79c8e2aed8c8887b2b76b6c9767ffcba3720fa48394dfbc4bf0abae10320be29177b0258caa4fec267efe5309002d7a1e0882095d5
|
7
|
+
data.tar.gz: eadaf534d1782229706e15a12d8729e25aecca802fbdb0e1c2f17d3a67f8e5c09a4f4e249f6fe696e09cf6a96b44b5d2c25515b6b0bd0ea6a87d1457edabe76e
|
@@ -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.10.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
@@ -14,7 +14,7 @@ class GenericFormBuilder < ActionView::Helpers::FormBuilder
|
|
14
14
|
options, *args = args
|
15
15
|
options ||= {}
|
16
16
|
return super(field, *args) if options[:default_builder]
|
17
|
-
note =
|
17
|
+
note = note_html(options[:note])
|
18
18
|
button = ' '+content_tag(:button, content_tag(:span, options[:button])) if options[:button]
|
19
19
|
|
20
20
|
html_options = {}
|
@@ -31,21 +31,22 @@ class GenericFormBuilder < ActionView::Helpers::FormBuilder
|
|
31
31
|
def select(field, collection, options = {}, html_options = {})
|
32
32
|
return super if options[:default_builder]
|
33
33
|
label_text = options[:label] || field.to_s.humanize
|
34
|
-
note =
|
34
|
+
note = note_html(options[:note])
|
35
35
|
content_tag(:p, label(field, "#{label_text} #{errors_text(field)}") + note + super)
|
36
36
|
end
|
37
37
|
|
38
38
|
def collection_select(field, collection, value_method, name_method, options = {}, html_options = {})
|
39
39
|
return super(field, collection, value_method, name_method) if options[:default_builder]
|
40
40
|
label_text = options[:label] || field.to_s.humanize
|
41
|
-
note =
|
41
|
+
note = note_html(options[:note])
|
42
42
|
content_tag(:p, label(field, "#{label_text} #{errors_text(field)}") + note + super(field, collection, value_method, name_method))
|
43
43
|
end
|
44
44
|
|
45
45
|
def check_box(field, options = {})
|
46
46
|
return super if options[:default_builder]
|
47
47
|
label_text = options[:label] || field.to_s.humanize
|
48
|
-
|
48
|
+
note = note_html(options[:note])
|
49
|
+
content_tag(:p, label(field, super + " #{label_text} #{errors_text(field)}" + note, :class => 'checkbox'))
|
49
50
|
end
|
50
51
|
|
51
52
|
def radio_button(field, value, options = {})
|
@@ -73,4 +74,17 @@ protected
|
|
73
74
|
@object.errors[field].join(' and ')
|
74
75
|
end
|
75
76
|
|
77
|
+
def note_html(note)
|
78
|
+
return unless note
|
79
|
+
|
80
|
+
if note.is_a?(Hash)
|
81
|
+
note_text = note.fetch(:text)
|
82
|
+
options = note.except(:text)
|
83
|
+
else
|
84
|
+
note_text = note
|
85
|
+
end
|
86
|
+
|
87
|
+
content_tag(:span, note_text, :class => (options[:class] || 'note'))
|
88
|
+
end
|
89
|
+
|
76
90
|
end
|
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.
|
4
|
+
version: 0.10.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-
|
14
|
+
date: 2014-11-11 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.
|
45
|
+
rubygems_version: 2.2.2
|
46
46
|
signing_key:
|
47
47
|
specification_version: 4
|
48
48
|
summary: Generic Rails 3 form builder
|