labelled_form 0.1.0 → 0.2.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 -5
- data/Gemfile.lock +18 -18
- data/README.md +4 -1
- data/lib/labelled_form/version.rb +1 -1
- data/lib/labelled_form.rb +9 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 770062f3522df751cc982985b0c1accc7e137940236bc791cdfda452a3dee75f
|
4
|
+
data.tar.gz: 3241c76e9ef10222b8ac2f7bc0f7774153e4dd08ede564d848a2bc16e12b6eab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fc75c53e7bfa702afbfd1cec7c001d2b89a6f2826eef6118b3cec5b7b5fa371a5af063b09eb2ed4fcf4cdf806a8f1de30e873a86bd76f0bf79a6a335f04101e
|
7
|
+
data.tar.gz: 6c07324a1abb699fbf88f2c6020da350f467e0be7879a58243fb0ef180aeb2c36062730acdee2b0a2f9aba87966d5e00b9351246c68b202bb6c56c9571d38170
|
data/Gemfile.lock
CHANGED
@@ -1,42 +1,42 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
labelled_form (0.
|
4
|
+
labelled_form (0.2.0)
|
5
5
|
actionview
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actionview (5.2.1)
|
11
|
-
activesupport (= 5.2.1)
|
10
|
+
actionview (5.2.4.1)
|
11
|
+
activesupport (= 5.2.4.1)
|
12
12
|
builder (~> 3.1)
|
13
13
|
erubi (~> 1.4)
|
14
14
|
rails-dom-testing (~> 2.0)
|
15
15
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
16
|
-
activesupport (5.2.1)
|
16
|
+
activesupport (5.2.4.1)
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
18
|
i18n (>= 0.7, < 2)
|
19
19
|
minitest (~> 5.1)
|
20
20
|
tzinfo (~> 1.1)
|
21
|
-
builder (3.2.
|
22
|
-
concurrent-ruby (1.
|
23
|
-
crass (1.0.
|
21
|
+
builder (3.2.4)
|
22
|
+
concurrent-ruby (1.1.5)
|
23
|
+
crass (1.0.6)
|
24
24
|
diff-lcs (1.3)
|
25
|
-
erubi (1.
|
26
|
-
i18n (1.
|
25
|
+
erubi (1.9.0)
|
26
|
+
i18n (1.8.2)
|
27
27
|
concurrent-ruby (~> 1.0)
|
28
|
-
loofah (2.
|
28
|
+
loofah (2.4.0)
|
29
29
|
crass (~> 1.0.2)
|
30
30
|
nokogiri (>= 1.5.9)
|
31
|
-
mini_portile2 (2.
|
32
|
-
minitest (5.
|
33
|
-
nokogiri (1.
|
34
|
-
mini_portile2 (~> 2.
|
31
|
+
mini_portile2 (2.4.0)
|
32
|
+
minitest (5.14.0)
|
33
|
+
nokogiri (1.10.7)
|
34
|
+
mini_portile2 (~> 2.4.0)
|
35
35
|
rails-dom-testing (2.0.3)
|
36
36
|
activesupport (>= 4.2.0)
|
37
37
|
nokogiri (>= 1.6)
|
38
|
-
rails-html-sanitizer (1.0
|
39
|
-
loofah (~> 2.
|
38
|
+
rails-html-sanitizer (1.3.0)
|
39
|
+
loofah (~> 2.3)
|
40
40
|
rake (10.5.0)
|
41
41
|
rspec (3.8.0)
|
42
42
|
rspec-core (~> 3.8.0)
|
@@ -52,7 +52,7 @@ GEM
|
|
52
52
|
rspec-support (~> 3.8.0)
|
53
53
|
rspec-support (3.8.0)
|
54
54
|
thread_safe (0.3.6)
|
55
|
-
tzinfo (1.2.
|
55
|
+
tzinfo (1.2.6)
|
56
56
|
thread_safe (~> 0.1)
|
57
57
|
|
58
58
|
PLATFORMS
|
@@ -65,4 +65,4 @@ DEPENDENCIES
|
|
65
65
|
rspec (~> 3.0)
|
66
66
|
|
67
67
|
BUNDLED WITH
|
68
|
-
1.
|
68
|
+
1.17.3
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ Adds `label:` option to Rails form helpers.
|
|
6
6
|
|
7
7
|
Works like you'd expect, or at least, works like I'd expect! Examples:
|
8
8
|
|
9
|
-
```
|
9
|
+
```ruby
|
10
10
|
form_with :user do |form|
|
11
11
|
|
12
12
|
# Prepends label to field and infers label text
|
@@ -27,6 +27,9 @@ form_with :user do |form|
|
|
27
27
|
end
|
28
28
|
```
|
29
29
|
|
30
|
+
## Todo
|
31
|
+
Figure out how to support options for the label tag, like `class:` and, uh, idk, other stuff. Maybe just pass options hash directly to `label:`? Maybe just start with additional `label_class:` option? Is there any other potential option for e.g. `form.label` we would care about? Probably should just cross this bridge when we get to it.
|
32
|
+
|
30
33
|
## Contributing
|
31
34
|
|
32
35
|
Bug reports and pull requests are welcome on GitHub at https://github.com/botandrose/labelled_form.
|
data/lib/labelled_form.rb
CHANGED
@@ -45,6 +45,15 @@ module LabelledForm
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
def file_field method, options = {}
|
49
|
+
if label_text = options[:label]
|
50
|
+
label_text = method.to_s.humanize if label_text === true
|
51
|
+
label(method, label_text) + " ".html_safe + super
|
52
|
+
else
|
53
|
+
super
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
48
57
|
def radio_button(method, tag_value, options = {})
|
49
58
|
label_text = options.delete(:label)
|
50
59
|
super.tap do |out|
|
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.
|
4
|
+
version: 0.2.0
|
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: 2020-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -107,8 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
|
-
|
111
|
-
rubygems_version: 2.6.14
|
110
|
+
rubygems_version: 3.0.4
|
112
111
|
signing_key:
|
113
112
|
specification_version: 4
|
114
113
|
summary: Adds label option to Rails form helpers
|