labelled_form 0.2.0 → 0.2.4
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 +4 -4
- data/.gitignore +2 -2
- data/labelled_form.gemspec +2 -2
- data/lib/labelled_form/version.rb +1 -1
- data/lib/labelled_form.rb +14 -9
- metadata +11 -14
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/Gemfile.lock +0 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b58e84e22bb1f12df2f02c2e136989e5be00ecb3eba4581f677d52f021fc471
|
4
|
+
data.tar.gz: acb13a7a2520c75ced8bcaaef5f391e3360c7120ca22c65b89b8b0594030a3c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f46c9d747077fab1a02e9d578d823bb2d65c4630c128d68692f6127731053bceab8b7cc41a015711a0f79a70cbaff88bcab4aad34897a483f833508b3eaed483
|
7
|
+
data.tar.gz: fc2498ec4eaca65425d8911b6c3676df43504c734685df7b090d1d336d29b5bf784f5935031b725d5c1cda88eabd22d2defa4e0635dd45a29d9035dfa96590b8
|
data/.gitignore
CHANGED
data/labelled_form.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
|
26
26
|
spec.add_dependency "actionview"
|
27
27
|
|
28
|
-
spec.add_development_dependency "bundler"
|
29
|
-
spec.add_development_dependency "rake"
|
28
|
+
spec.add_development_dependency "bundler"
|
29
|
+
spec.add_development_dependency "rake"
|
30
30
|
spec.add_development_dependency "rspec", "~> 3.0"
|
31
31
|
end
|
data/lib/labelled_form.rb
CHANGED
@@ -10,7 +10,8 @@ module LabelledForm
|
|
10
10
|
|
11
11
|
class Builder < ActionView::Helpers::FormBuilder
|
12
12
|
def text_area method, options = {}
|
13
|
-
|
13
|
+
options = options.dup
|
14
|
+
if label_text = options.delete(:label)
|
14
15
|
label_text = method.to_s.humanize if label_text === true
|
15
16
|
label(method, label_text) + " ".html_safe + super
|
16
17
|
else
|
@@ -19,7 +20,8 @@ module LabelledForm
|
|
19
20
|
end
|
20
21
|
|
21
22
|
def date_field method, options = {}
|
22
|
-
|
23
|
+
options = options.dup
|
24
|
+
if label_text = options.delete(:label)
|
23
25
|
label_text = method.to_s.humanize if label_text === true
|
24
26
|
label(method, label_text) + " ".html_safe + super
|
25
27
|
else
|
@@ -28,7 +30,8 @@ module LabelledForm
|
|
28
30
|
end
|
29
31
|
|
30
32
|
def email_field method, options = {}
|
31
|
-
|
33
|
+
options = options.dup
|
34
|
+
if label_text = options.delete(:label)
|
32
35
|
label_text = method.to_s.humanize if label_text === true
|
33
36
|
label(method, label_text) + " ".html_safe + super
|
34
37
|
else
|
@@ -37,7 +40,8 @@ module LabelledForm
|
|
37
40
|
end
|
38
41
|
|
39
42
|
def text_field method, options = {}
|
40
|
-
|
43
|
+
options = options.dup
|
44
|
+
if label_text = options.delete(:label)
|
41
45
|
label_text = method.to_s.humanize if label_text === true
|
42
46
|
label(method, label_text) + " ".html_safe + super
|
43
47
|
else
|
@@ -46,7 +50,8 @@ module LabelledForm
|
|
46
50
|
end
|
47
51
|
|
48
52
|
def file_field method, options = {}
|
49
|
-
|
53
|
+
options = options.dup
|
54
|
+
if label_text = options.delete(:label)
|
50
55
|
label_text = method.to_s.humanize if label_text === true
|
51
56
|
label(method, label_text) + " ".html_safe + super
|
52
57
|
else
|
@@ -55,23 +60,23 @@ module LabelledForm
|
|
55
60
|
end
|
56
61
|
|
57
62
|
def radio_button(method, tag_value, options = {})
|
63
|
+
options = options.dup
|
58
64
|
label_text = options.delete(:label)
|
59
65
|
super.tap do |out|
|
60
66
|
if label_text
|
61
67
|
label_text = tag_value if label_text === true
|
62
|
-
label_field = :"#{method}_#{label_text.to_s.gsub(/\s/, "_").gsub(/[^-\w]/, "").downcase}"
|
63
|
-
|
64
68
|
out << " ".html_safe
|
65
|
-
out << label(
|
69
|
+
out << label(method, label_text, value: tag_value)
|
66
70
|
end
|
67
71
|
end
|
68
72
|
end
|
69
73
|
|
70
74
|
def check_box(method, options = {}, checked_value = "1", unchecked_value = "0")
|
75
|
+
options = options.dup
|
71
76
|
label_text = options.delete(:label)
|
72
77
|
super.tap do |out|
|
73
78
|
if label_text
|
74
|
-
label_text = checked_value if label_text === true
|
79
|
+
label_text = checked_value == "1" ? nil : checked_value if label_text === true
|
75
80
|
out << " ".html_safe
|
76
81
|
label_options = options[:multiple] ? { value: checked_value } : {}
|
77
82
|
out << label(method, label_text, label_options)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: labelled_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Geisel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -28,30 +28,30 @@ dependencies:
|
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,11 +75,8 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
77
|
- ".rspec"
|
78
|
-
- ".ruby-gemset"
|
79
|
-
- ".ruby-version"
|
80
78
|
- ".travis.yml"
|
81
79
|
- Gemfile
|
82
|
-
- Gemfile.lock
|
83
80
|
- LICENSE.txt
|
84
81
|
- README.md
|
85
82
|
- Rakefile
|
@@ -107,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
104
|
- !ruby/object:Gem::Version
|
108
105
|
version: '0'
|
109
106
|
requirements: []
|
110
|
-
rubygems_version: 3.
|
107
|
+
rubygems_version: 3.2.3
|
111
108
|
signing_key:
|
112
109
|
specification_version: 4
|
113
110
|
summary: Adds label option to Rails form helpers
|
data/.ruby-gemset
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
labelled_form
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ruby-2.4.3
|
data/Gemfile.lock
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
labelled_form (0.2.0)
|
5
|
-
actionview
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
actionview (5.2.4.1)
|
11
|
-
activesupport (= 5.2.4.1)
|
12
|
-
builder (~> 3.1)
|
13
|
-
erubi (~> 1.4)
|
14
|
-
rails-dom-testing (~> 2.0)
|
15
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
16
|
-
activesupport (5.2.4.1)
|
17
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
-
i18n (>= 0.7, < 2)
|
19
|
-
minitest (~> 5.1)
|
20
|
-
tzinfo (~> 1.1)
|
21
|
-
builder (3.2.4)
|
22
|
-
concurrent-ruby (1.1.5)
|
23
|
-
crass (1.0.6)
|
24
|
-
diff-lcs (1.3)
|
25
|
-
erubi (1.9.0)
|
26
|
-
i18n (1.8.2)
|
27
|
-
concurrent-ruby (~> 1.0)
|
28
|
-
loofah (2.4.0)
|
29
|
-
crass (~> 1.0.2)
|
30
|
-
nokogiri (>= 1.5.9)
|
31
|
-
mini_portile2 (2.4.0)
|
32
|
-
minitest (5.14.0)
|
33
|
-
nokogiri (1.10.7)
|
34
|
-
mini_portile2 (~> 2.4.0)
|
35
|
-
rails-dom-testing (2.0.3)
|
36
|
-
activesupport (>= 4.2.0)
|
37
|
-
nokogiri (>= 1.6)
|
38
|
-
rails-html-sanitizer (1.3.0)
|
39
|
-
loofah (~> 2.3)
|
40
|
-
rake (10.5.0)
|
41
|
-
rspec (3.8.0)
|
42
|
-
rspec-core (~> 3.8.0)
|
43
|
-
rspec-expectations (~> 3.8.0)
|
44
|
-
rspec-mocks (~> 3.8.0)
|
45
|
-
rspec-core (3.8.0)
|
46
|
-
rspec-support (~> 3.8.0)
|
47
|
-
rspec-expectations (3.8.1)
|
48
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
-
rspec-support (~> 3.8.0)
|
50
|
-
rspec-mocks (3.8.0)
|
51
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
52
|
-
rspec-support (~> 3.8.0)
|
53
|
-
rspec-support (3.8.0)
|
54
|
-
thread_safe (0.3.6)
|
55
|
-
tzinfo (1.2.6)
|
56
|
-
thread_safe (~> 0.1)
|
57
|
-
|
58
|
-
PLATFORMS
|
59
|
-
ruby
|
60
|
-
|
61
|
-
DEPENDENCIES
|
62
|
-
bundler (~> 1.16)
|
63
|
-
labelled_form!
|
64
|
-
rake (~> 10.0)
|
65
|
-
rspec (~> 3.0)
|
66
|
-
|
67
|
-
BUNDLED WITH
|
68
|
-
1.17.3
|