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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 770062f3522df751cc982985b0c1accc7e137940236bc791cdfda452a3dee75f
4
- data.tar.gz: 3241c76e9ef10222b8ac2f7bc0f7774153e4dd08ede564d848a2bc16e12b6eab
3
+ metadata.gz: 2b58e84e22bb1f12df2f02c2e136989e5be00ecb3eba4581f677d52f021fc471
4
+ data.tar.gz: acb13a7a2520c75ced8bcaaef5f391e3360c7120ca22c65b89b8b0594030a3c8
5
5
  SHA512:
6
- metadata.gz: 6fc75c53e7bfa702afbfd1cec7c001d2b89a6f2826eef6118b3cec5b7b5fa371a5af063b09eb2ed4fcf4cdf806a8f1de30e873a86bd76f0bf79a6a335f04101e
7
- data.tar.gz: 6c07324a1abb699fbf88f2c6020da350f467e0be7879a58243fb0ef180aeb2c36062730acdee2b0a2f9aba87966d5e00b9351246c68b202bb6c56c9571d38170
6
+ metadata.gz: f46c9d747077fab1a02e9d578d823bb2d65c4630c128d68692f6127731053bceab8b7cc41a015711a0f79a70cbaff88bcab4aad34897a483f833508b3eaed483
7
+ data.tar.gz: fc2498ec4eaca65425d8911b6c3676df43504c734685df7b090d1d336d29b5bf784f5935031b725d5c1cda88eabd22d2defa4e0635dd45a29d9035dfa96590b8
data/.gitignore CHANGED
@@ -6,8 +6,8 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
- /.ruby_version
10
- /.ruby_gemset
9
+ /.ruby-version
10
+ /Gemfile.lock
11
11
 
12
12
  # rspec failure tracking
13
13
  .rspec_status
@@ -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", "~> 1.16"
29
- spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "bundler"
29
+ spec.add_development_dependency "rake"
30
30
  spec.add_development_dependency "rspec", "~> 3.0"
31
31
  end
@@ -1,3 +1,3 @@
1
1
  module LabelledForm
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.4"
3
3
  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
- if label_text = options[:label]
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
- if label_text = options[:label]
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
- if label_text = options[:label]
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
- if label_text = options[:label]
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
- if label_text = options[:label]
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(label_field, label_text)
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.0
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: 2020-01-29 00:00:00.000000000 Z
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: '1.16'
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: '1.16'
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: '10.0'
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: '10.0'
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.0.4
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