dom_id_nested 1.0.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 +7 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.standard.yml +3 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +116 -0
- data/LICENSE.txt +21 -0
- data/README.md +52 -0
- data/Rakefile +10 -0
- data/lib/dom_id_nested/version.rb +3 -0
- data/lib/dom_id_nested.rb +18 -0
- data/sig/dom_id_nested.rbs +4 -0
- metadata +141 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ff102e081f3f1b17920c60be983e7ce7fd7cd6e4c16bec9eee833e8aaa45edf6
|
4
|
+
data.tar.gz: ddf7995a9d3525ed5324f6653172ed4d6deb00f4bf1af36bb42d52e759b5ca6d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1830b5a034509385021b220613f743a2088e60092118d9e1cbb2e9f6e4ccada4cbcb302642ef309571c5d5fba4dc45515a28b3ef45bfa5d52ffbe4c7caef2ded
|
7
|
+
data.tar.gz: 8e85c200cdaa69cfdb5e51d27d07dfa76ac9e7fa28d5a5a1cad80f339fff62403f6b24a41802dfa45589259e11d6c54fb56fc15f68501c05733fab3256a69c8a
|
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.2.2
|
data/.standard.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
dom_id_nested (1.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
actionview (7.0.4.3)
|
10
|
+
activesupport (= 7.0.4.3)
|
11
|
+
builder (~> 3.1)
|
12
|
+
erubi (~> 1.4)
|
13
|
+
rails-dom-testing (~> 2.0)
|
14
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
15
|
+
activesupport (7.0.4.3)
|
16
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
+
i18n (>= 1.6, < 2)
|
18
|
+
minitest (>= 5.1)
|
19
|
+
tzinfo (~> 2.0)
|
20
|
+
ast (2.4.2)
|
21
|
+
builder (3.2.4)
|
22
|
+
coderay (1.1.3)
|
23
|
+
concurrent-ruby (1.2.2)
|
24
|
+
crass (1.0.6)
|
25
|
+
diff-lcs (1.5.0)
|
26
|
+
erubi (1.12.0)
|
27
|
+
i18n (1.13.0)
|
28
|
+
concurrent-ruby (~> 1.0)
|
29
|
+
json (2.6.3)
|
30
|
+
language_server-protocol (3.17.0.3)
|
31
|
+
lint_roller (1.0.0)
|
32
|
+
loofah (2.21.2)
|
33
|
+
crass (~> 1.0.2)
|
34
|
+
nokogiri (>= 1.12.0)
|
35
|
+
method_source (1.0.0)
|
36
|
+
minitest (5.18.0)
|
37
|
+
nokogiri (1.14.4-arm64-darwin)
|
38
|
+
racc (~> 1.4)
|
39
|
+
nokogiri (1.14.4-x86_64-linux)
|
40
|
+
racc (~> 1.4)
|
41
|
+
parallel (1.23.0)
|
42
|
+
parser (3.2.2.1)
|
43
|
+
ast (~> 2.4.1)
|
44
|
+
pry (0.14.2)
|
45
|
+
coderay (~> 1.1)
|
46
|
+
method_source (~> 1.0)
|
47
|
+
racc (1.6.2)
|
48
|
+
rails-dom-testing (2.0.3)
|
49
|
+
activesupport (>= 4.2.0)
|
50
|
+
nokogiri (>= 1.6)
|
51
|
+
rails-html-sanitizer (1.5.0)
|
52
|
+
loofah (~> 2.19, >= 2.19.1)
|
53
|
+
rainbow (3.1.1)
|
54
|
+
rake (13.0.6)
|
55
|
+
regexp_parser (2.8.0)
|
56
|
+
rexml (3.2.5)
|
57
|
+
rspec (3.12.0)
|
58
|
+
rspec-core (~> 3.12.0)
|
59
|
+
rspec-expectations (~> 3.12.0)
|
60
|
+
rspec-mocks (~> 3.12.0)
|
61
|
+
rspec-core (3.12.2)
|
62
|
+
rspec-support (~> 3.12.0)
|
63
|
+
rspec-expectations (3.12.3)
|
64
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
65
|
+
rspec-support (~> 3.12.0)
|
66
|
+
rspec-mocks (3.12.5)
|
67
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
+
rspec-support (~> 3.12.0)
|
69
|
+
rspec-support (3.12.0)
|
70
|
+
rubocop (1.50.2)
|
71
|
+
json (~> 2.3)
|
72
|
+
parallel (~> 1.10)
|
73
|
+
parser (>= 3.2.0.0)
|
74
|
+
rainbow (>= 2.2.2, < 4.0)
|
75
|
+
regexp_parser (>= 1.8, < 3.0)
|
76
|
+
rexml (>= 3.2.5, < 4.0)
|
77
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
78
|
+
ruby-progressbar (~> 1.7)
|
79
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
80
|
+
rubocop-ast (1.28.1)
|
81
|
+
parser (>= 3.2.1.0)
|
82
|
+
rubocop-performance (1.16.0)
|
83
|
+
rubocop (>= 1.7.0, < 2.0)
|
84
|
+
rubocop-ast (>= 0.4.0)
|
85
|
+
ruby-progressbar (1.13.0)
|
86
|
+
standard (1.28.2)
|
87
|
+
language_server-protocol (~> 3.17.0.2)
|
88
|
+
lint_roller (~> 1.0)
|
89
|
+
rubocop (~> 1.50.2)
|
90
|
+
standard-custom (~> 1.0.0)
|
91
|
+
standard-performance (~> 1.0.1)
|
92
|
+
standard-custom (1.0.0)
|
93
|
+
lint_roller (~> 1.0)
|
94
|
+
standard-performance (1.0.1)
|
95
|
+
lint_roller (~> 1.0)
|
96
|
+
rubocop-performance (~> 1.16.0)
|
97
|
+
tzinfo (2.0.6)
|
98
|
+
concurrent-ruby (~> 1.0)
|
99
|
+
unicode-display_width (2.4.2)
|
100
|
+
|
101
|
+
PLATFORMS
|
102
|
+
arm64-darwin-21
|
103
|
+
arm64-darwin-22
|
104
|
+
x86_64-linux
|
105
|
+
|
106
|
+
DEPENDENCIES
|
107
|
+
actionview
|
108
|
+
bundler (~> 2.0)
|
109
|
+
dom_id_nested!
|
110
|
+
pry
|
111
|
+
rake (~> 13.0)
|
112
|
+
rspec (~> 3.0)
|
113
|
+
standard
|
114
|
+
|
115
|
+
BUNDLED WITH
|
116
|
+
2.4.12
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Eddie Rodriguez
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# DomIdNested
|
2
|
+
|
3
|
+
DomIdNested is a Ruby on Rails gem that extends the functionality of the built-in `dom_id` helper, making it more versatile by allowing it to work with a combination of ActiveRecord models and custom strings.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem "dom_id_nested"
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
```zsh
|
16
|
+
$ bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
With DomIdNested, you can easily generate DOM IDs by passing a combination of ActiveRecord models and custom strings to the dom_id helper. Here’s an example:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
user = User.find(1)
|
25
|
+
|
26
|
+
dom_id(user, "edit_button") #=> "user_1_edit_button"
|
27
|
+
```
|
28
|
+
|
29
|
+
You can also pass multiple ActiveRecord models and strings as arguments:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
post = Post.find(1)
|
33
|
+
comment = Comment.find(2)
|
34
|
+
|
35
|
+
dom_id(user, post, comment, "content") #=> "user_1_post_1_comment_2_content"
|
36
|
+
```
|
37
|
+
|
38
|
+
The gem will automatically omit any blank records passed:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
dom_id(user, nil, "", "edit_button") #=> "user_1_edit_button"
|
42
|
+
```
|
43
|
+
|
44
|
+
If all records are blank, the dom_id helper will return nil:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
dom_id(nil, "") #=> nil
|
48
|
+
```
|
49
|
+
|
50
|
+
## License
|
51
|
+
|
52
|
+
The gem is available as open source under the terms of the MIT License » https://opensource.org/licenses/MIT.
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative "dom_id_nested/version"
|
2
|
+
|
3
|
+
require "active_support/core_ext/enumerable"
|
4
|
+
require "action_view"
|
5
|
+
|
6
|
+
module DomIdNested
|
7
|
+
class Error < StandardError; end
|
8
|
+
|
9
|
+
def dom_id(*args)
|
10
|
+
args
|
11
|
+
.compact_blank
|
12
|
+
.map { |record| record.respond_to?(:to_key) ? super(record) : record }
|
13
|
+
.join("_").presence
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# Monkey patch ActionView::RecordIdentifier#dom_id
|
18
|
+
ActionView::RecordIdentifier.send(:prepend, DomIdNested)
|
metadata
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dom_id_nested
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eddie Rodriguez
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-05-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '13.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '13.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: actionview
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: standard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: A gem that enhances the Rails dom_id helper method, allowing it to accept
|
98
|
+
multiple ActiveRecord models or custom strings as arguments.
|
99
|
+
email:
|
100
|
+
- 8533760+nwoeddie@users.noreply.github.com
|
101
|
+
executables: []
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".rspec"
|
106
|
+
- ".ruby-version"
|
107
|
+
- ".standard.yml"
|
108
|
+
- Gemfile
|
109
|
+
- Gemfile.lock
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- lib/dom_id_nested.rb
|
114
|
+
- lib/dom_id_nested/version.rb
|
115
|
+
- sig/dom_id_nested.rbs
|
116
|
+
homepage: https://github.com/firmstudio/dom_id_nested
|
117
|
+
licenses:
|
118
|
+
- MIT
|
119
|
+
metadata:
|
120
|
+
homepage_uri: https://github.com/firmstudio/dom_id_nested
|
121
|
+
source_code_uri: https://github.com/firmstudio/dom_id_nested
|
122
|
+
post_install_message:
|
123
|
+
rdoc_options: []
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 2.6.0
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubygems_version: 3.4.12
|
138
|
+
signing_key:
|
139
|
+
specification_version: 4
|
140
|
+
summary: Upgraded `dom_id` helper for Ruby on Rails
|
141
|
+
test_files: []
|