simpler_navigation 0.1.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/.standard.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +107 -0
- data/LICENSE.txt +21 -0
- data/README.md +33 -0
- data/Rakefile +14 -0
- data/lib/simpler_navigation/configuration.rb +28 -0
- data/lib/simpler_navigation/item.rb +38 -0
- data/lib/simpler_navigation/railtie.rb +12 -0
- data/lib/simpler_navigation/renderers/base.rb +180 -0
- data/lib/simpler_navigation/renderers/breadcrumb.rb +36 -0
- data/lib/simpler_navigation/renderers/list.rb +27 -0
- data/lib/simpler_navigation/version.rb +5 -0
- data/lib/simpler_navigation/view_helpers.rb +7 -0
- data/lib/simpler_navigation.rb +17 -0
- data/sig/simpler_navigation.rbs +4 -0
- data/simpler_navigation.gemspec +36 -0
- metadata +92 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: affd12b2c48dcc0b8d8170a995f44a41bb1eb8dd79b0777558d748e1d79ece08
|
4
|
+
data.tar.gz: a2f46bd7e2a3237100c81789db92d8ae1f4d405bec317ad6b252270b36c13d2c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4c707bfeccaf400af2517bfeb2840591ef3d1e5c91f880818f361d71ce68c51bcea7f7fef9deb9b58c8ccc3a8af10374d52b8465e98edbfb6c2b1048371f7924
|
7
|
+
data.tar.gz: b4459aa5521c300c7956ff0cad8fa8441e5774ae419e62beeeee292e1e0d521a4a2d13c537de0035c776961bf15eea7f8ef7a458d4e237a678d5c4b865f5f747
|
data/.standard.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
simpler_navigation (0.1.0)
|
5
|
+
actionview
|
6
|
+
railties
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionpack (7.0.4.2)
|
12
|
+
actionview (= 7.0.4.2)
|
13
|
+
activesupport (= 7.0.4.2)
|
14
|
+
rack (~> 2.0, >= 2.2.0)
|
15
|
+
rack-test (>= 0.6.3)
|
16
|
+
rails-dom-testing (~> 2.0)
|
17
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
|
+
actionview (7.0.4.2)
|
19
|
+
activesupport (= 7.0.4.2)
|
20
|
+
builder (~> 3.1)
|
21
|
+
erubi (~> 1.4)
|
22
|
+
rails-dom-testing (~> 2.0)
|
23
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
+
activesupport (7.0.4.2)
|
25
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
26
|
+
i18n (>= 1.6, < 2)
|
27
|
+
minitest (>= 5.1)
|
28
|
+
tzinfo (~> 2.0)
|
29
|
+
ast (2.4.2)
|
30
|
+
builder (3.2.4)
|
31
|
+
concurrent-ruby (1.2.2)
|
32
|
+
crass (1.0.6)
|
33
|
+
erubi (1.12.0)
|
34
|
+
i18n (1.12.0)
|
35
|
+
concurrent-ruby (~> 1.0)
|
36
|
+
json (2.6.3)
|
37
|
+
language_server-protocol (3.17.0.3)
|
38
|
+
loofah (2.19.1)
|
39
|
+
crass (~> 1.0.2)
|
40
|
+
nokogiri (>= 1.5.9)
|
41
|
+
method_source (1.0.0)
|
42
|
+
minitest (5.17.0)
|
43
|
+
nokogiri (1.14.2-arm64-darwin)
|
44
|
+
racc (~> 1.4)
|
45
|
+
nokogiri (1.14.2-x86_64-linux)
|
46
|
+
racc (~> 1.4)
|
47
|
+
parallel (1.22.1)
|
48
|
+
parser (3.2.1.0)
|
49
|
+
ast (~> 2.4.1)
|
50
|
+
racc (1.6.2)
|
51
|
+
rack (2.2.6.2)
|
52
|
+
rack-test (2.0.2)
|
53
|
+
rack (>= 1.3)
|
54
|
+
rails-dom-testing (2.0.3)
|
55
|
+
activesupport (>= 4.2.0)
|
56
|
+
nokogiri (>= 1.6)
|
57
|
+
rails-html-sanitizer (1.5.0)
|
58
|
+
loofah (~> 2.19, >= 2.19.1)
|
59
|
+
railties (7.0.4.2)
|
60
|
+
actionpack (= 7.0.4.2)
|
61
|
+
activesupport (= 7.0.4.2)
|
62
|
+
method_source
|
63
|
+
rake (>= 12.2)
|
64
|
+
thor (~> 1.0)
|
65
|
+
zeitwerk (~> 2.5)
|
66
|
+
rainbow (3.1.1)
|
67
|
+
rake (13.0.6)
|
68
|
+
regexp_parser (2.7.0)
|
69
|
+
rexml (3.2.5)
|
70
|
+
rubocop (1.44.1)
|
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.24.1, < 2.0)
|
78
|
+
ruby-progressbar (~> 1.7)
|
79
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
80
|
+
rubocop-ast (1.27.0)
|
81
|
+
parser (>= 3.2.1.0)
|
82
|
+
rubocop-performance (1.15.2)
|
83
|
+
rubocop (>= 1.7.0, < 2.0)
|
84
|
+
rubocop-ast (>= 0.4.0)
|
85
|
+
ruby-progressbar (1.11.0)
|
86
|
+
standard (1.24.3)
|
87
|
+
language_server-protocol (~> 3.17.0.2)
|
88
|
+
rubocop (= 1.44.1)
|
89
|
+
rubocop-performance (= 1.15.2)
|
90
|
+
thor (1.2.1)
|
91
|
+
tzinfo (2.0.6)
|
92
|
+
concurrent-ruby (~> 1.0)
|
93
|
+
unicode-display_width (2.4.2)
|
94
|
+
zeitwerk (2.6.7)
|
95
|
+
|
96
|
+
PLATFORMS
|
97
|
+
arm64-darwin-21
|
98
|
+
x86_64-linux
|
99
|
+
|
100
|
+
DEPENDENCIES
|
101
|
+
minitest (~> 5.0)
|
102
|
+
rake (~> 13.0)
|
103
|
+
simpler_navigation!
|
104
|
+
standard (~> 1.3)
|
105
|
+
|
106
|
+
BUNDLED WITH
|
107
|
+
2.4.6
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Nick Muerdter
|
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,33 @@
|
|
1
|
+
# Simpler Navigation
|
2
|
+
|
3
|
+
A Rails gem to handle navigation menus and breadcrumbs.
|
4
|
+
|
5
|
+
Heavily inspired by [Simple Navigation](https://github.com/codeplant/simple-navigation/tree/master), but aiming to address performance and thread safety issues with a smaller feature set.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Install the gem and add to the application's Gemfile by executing:
|
10
|
+
|
11
|
+
$ bundle add simpler_navigation
|
12
|
+
|
13
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
|
+
|
15
|
+
$ gem install simpler_navigation
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
TODO: Write usage instructions here
|
20
|
+
|
21
|
+
## Development
|
22
|
+
|
23
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
24
|
+
|
25
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/simpler_navigation.
|
30
|
+
|
31
|
+
## License
|
32
|
+
|
33
|
+
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,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.libs << "lib"
|
9
|
+
t.test_files = FileList["test/**/test_*.rb"]
|
10
|
+
end
|
11
|
+
|
12
|
+
require "standard/rake"
|
13
|
+
|
14
|
+
task default: %i[test standard]
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module SimplerNavigation
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :selected_class
|
4
|
+
attr_accessor :active_leaf_class
|
5
|
+
attr_reader :root_item
|
6
|
+
|
7
|
+
def self.run(&block)
|
8
|
+
SimplerNavigation.config = new(&block)
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
@selected_class = "selected"
|
13
|
+
@active_leaf_class = "simple-navigation-active-leaf"
|
14
|
+
|
15
|
+
if block_given?
|
16
|
+
yield self
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def items
|
21
|
+
@root_item = Item.new(key: nil, name: nil, url: nil)
|
22
|
+
|
23
|
+
if block_given?
|
24
|
+
yield @root_item
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module SimplerNavigation
|
2
|
+
class Item
|
3
|
+
attr_reader :name
|
4
|
+
attr_reader :url
|
5
|
+
attr_reader :level
|
6
|
+
attr_reader :options
|
7
|
+
attr_reader :children
|
8
|
+
|
9
|
+
def initialize(key:, name:, url:, level: 0, options: {})
|
10
|
+
@key = key
|
11
|
+
@name = name
|
12
|
+
@url = url
|
13
|
+
@level = level
|
14
|
+
@options = options
|
15
|
+
@children = {}
|
16
|
+
end
|
17
|
+
|
18
|
+
def item(key, name, url, options = {})
|
19
|
+
if @children[key]
|
20
|
+
raise "Navigation item already exists for #{key.inspect}"
|
21
|
+
end
|
22
|
+
|
23
|
+
@children[key] = Item.new(key: key, name: name, url: url, level: @level + 1, options: options)
|
24
|
+
|
25
|
+
if block_given?
|
26
|
+
yield @children[key]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def [](key)
|
31
|
+
@children[key]
|
32
|
+
end
|
33
|
+
|
34
|
+
def fetch(key)
|
35
|
+
@children.fetch(key)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "rails/railtie"
|
2
|
+
require "simpler_navigation/view_helpers"
|
3
|
+
|
4
|
+
module SimplerNavigation
|
5
|
+
class Railtie < ::Rails::Railtie
|
6
|
+
initializer "simpler_navigation.view_helpers" do
|
7
|
+
ActiveSupport.on_load(:action_view) do
|
8
|
+
include ViewHelpers
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,180 @@
|
|
1
|
+
require "action_view"
|
2
|
+
|
3
|
+
module SimplerNavigation
|
4
|
+
module Renderers
|
5
|
+
class Base
|
6
|
+
include ActionView::Helpers::TagHelper
|
7
|
+
include ActionView::Helpers::UrlHelper
|
8
|
+
include ActionView::Helpers::OutputSafetyHelper
|
9
|
+
|
10
|
+
def initialize(context, item, options = {})
|
11
|
+
@selected = {}
|
12
|
+
@active_leaf = {}
|
13
|
+
@show = {}
|
14
|
+
|
15
|
+
@context = context
|
16
|
+
@item = item
|
17
|
+
@options = options
|
18
|
+
|
19
|
+
if @item.nil?
|
20
|
+
case @options[:level]
|
21
|
+
when :all
|
22
|
+
@item = SimplerNavigation.config.root_item
|
23
|
+
when Integer
|
24
|
+
@item = find_parent_item_for_level(SimplerNavigation.config.root_item, @options[:level])
|
25
|
+
when Range
|
26
|
+
@item = find_parent_item_for_level(SimplerNavigation.config.root_item, @options[:level].min)
|
27
|
+
else
|
28
|
+
raise Error, "Invalid navigation level: #{@options[:level]}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
protected
|
34
|
+
|
35
|
+
def find_parent_item_for_level(item, level)
|
36
|
+
parent_item = nil
|
37
|
+
|
38
|
+
if item.level == (level - 1)
|
39
|
+
parent_item = item
|
40
|
+
elsif item.children.any?
|
41
|
+
selected_child = item.children.find { |key, value| selected?(value) }&.last
|
42
|
+
if selected_child
|
43
|
+
parent_item = find_parent_item_for_level(selected_child, level)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
parent_item
|
48
|
+
end
|
49
|
+
|
50
|
+
def link_tag(item)
|
51
|
+
link_to(item.name, item.url, link_tag_options(item))
|
52
|
+
end
|
53
|
+
|
54
|
+
def link_tag_options(item)
|
55
|
+
options = if item.options[:link_html]
|
56
|
+
item.options[:link_html].dup
|
57
|
+
else
|
58
|
+
{}
|
59
|
+
end
|
60
|
+
|
61
|
+
classes = []
|
62
|
+
if options[:class]
|
63
|
+
classes << options[:class]
|
64
|
+
end
|
65
|
+
if selected?(item)
|
66
|
+
classes << SimplerNavigation.config.selected_class
|
67
|
+
end
|
68
|
+
options[:class] = classes.compact.join(" ")
|
69
|
+
|
70
|
+
options
|
71
|
+
end
|
72
|
+
|
73
|
+
def wrapper_tag_options(item)
|
74
|
+
options = if item.options[:html]
|
75
|
+
item.options[:html].dup
|
76
|
+
else
|
77
|
+
{}
|
78
|
+
end
|
79
|
+
|
80
|
+
classes = []
|
81
|
+
if options[:class]
|
82
|
+
classes << options[:class]
|
83
|
+
end
|
84
|
+
if selected?(item)
|
85
|
+
classes << SimplerNavigation.config.selected_class
|
86
|
+
end
|
87
|
+
if active_leaf?(item)
|
88
|
+
classes << SimplerNavigation.config.active_leaf_class
|
89
|
+
end
|
90
|
+
options[:class] = classes.compact.join(" ")
|
91
|
+
|
92
|
+
options
|
93
|
+
end
|
94
|
+
|
95
|
+
def include_sub_navigation?(item)
|
96
|
+
consider_sub_navigation?(item) && selected?(item)
|
97
|
+
end
|
98
|
+
|
99
|
+
def url_path(url)
|
100
|
+
url.sub(/[#?].*/, "")
|
101
|
+
end
|
102
|
+
|
103
|
+
def selected?(item)
|
104
|
+
return @selected[item] if @selected.key?(item)
|
105
|
+
|
106
|
+
selected = false
|
107
|
+
case item.options[:highlights_on]
|
108
|
+
when Regexp
|
109
|
+
selected = item.options[:highlights_on].match?(SimplerNavigation.request_fullpath)
|
110
|
+
when Proc
|
111
|
+
selected = item.options[:highlights_on].call
|
112
|
+
else
|
113
|
+
if SimplerNavigation.request_fullpath
|
114
|
+
item_url_path = url_path(item.url).downcase
|
115
|
+
selected = SimplerNavigation.request_fullpath.downcase.start_with?(item_url_path)
|
116
|
+
end
|
117
|
+
|
118
|
+
selected ||= item.children.any? do |key, value|
|
119
|
+
selected?(value)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
@selected[item] = selected
|
124
|
+
end
|
125
|
+
|
126
|
+
def active_leaf?(item)
|
127
|
+
return @active_leaf[item] if @active_leaf.key?(item)
|
128
|
+
|
129
|
+
active_leaf = false
|
130
|
+
if selected?(item)
|
131
|
+
active_leaf = item.children.none? do |key, value|
|
132
|
+
selected?(value)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
@active_leaf[item] = active_leaf
|
137
|
+
end
|
138
|
+
|
139
|
+
def show?(item)
|
140
|
+
return @show[item] if @show.key?(item)
|
141
|
+
|
142
|
+
show = true
|
143
|
+
if !item.options[:if].nil?
|
144
|
+
show = case item.options[:if]
|
145
|
+
when false
|
146
|
+
false
|
147
|
+
when true
|
148
|
+
true
|
149
|
+
else
|
150
|
+
item.options[:if].call
|
151
|
+
end
|
152
|
+
elsif !item.options[:unless].nil?
|
153
|
+
show = case item.options[:unless]
|
154
|
+
when false
|
155
|
+
true
|
156
|
+
when true
|
157
|
+
false
|
158
|
+
else
|
159
|
+
!item.options[:unless].call
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
@show[item] = show
|
164
|
+
end
|
165
|
+
|
166
|
+
def consider_sub_navigation?(item)
|
167
|
+
return false unless item.children.any?
|
168
|
+
|
169
|
+
case @options[:level]
|
170
|
+
when :all
|
171
|
+
true
|
172
|
+
when Range
|
173
|
+
item.level < @options[:level].max
|
174
|
+
else
|
175
|
+
false
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "simpler_navigation/renderers/base"
|
2
|
+
|
3
|
+
module SimplerNavigation
|
4
|
+
module Renderers
|
5
|
+
class Breadcrumb < Base
|
6
|
+
def render
|
7
|
+
tags = crumb_tags(@item)
|
8
|
+
|
9
|
+
join_with = @options[:join_with] || " "
|
10
|
+
content_tag(:div, safe_join(tags, join_with))
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def crumb_tags(parent_item)
|
16
|
+
tags = []
|
17
|
+
|
18
|
+
parent_item.children.each_value do |item|
|
19
|
+
next unless show?(item) && selected?(item)
|
20
|
+
|
21
|
+
tags << if @options[:static_leaf] && active_leaf?(item)
|
22
|
+
content_tag("span", item.name, link_tag_options(item))
|
23
|
+
else
|
24
|
+
link_tag(item)
|
25
|
+
end
|
26
|
+
|
27
|
+
if include_sub_navigation?(item)
|
28
|
+
tags += crumb_tags(item)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
tags
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "simpler_navigation/renderers/base"
|
2
|
+
|
3
|
+
module SimplerNavigation
|
4
|
+
module Renderers
|
5
|
+
class List < Base
|
6
|
+
def render
|
7
|
+
list = []
|
8
|
+
@item.children.each_value do |item|
|
9
|
+
next unless show?(item)
|
10
|
+
|
11
|
+
li_content = link_tag(item)
|
12
|
+
if include_sub_navigation?(item)
|
13
|
+
li_content << List.new(@context, item, @options).render
|
14
|
+
end
|
15
|
+
|
16
|
+
if @options[:render_content_partials] && item.options[:content_partial]
|
17
|
+
li_content << @context.render(partial: item.options[:content_partial])
|
18
|
+
end
|
19
|
+
|
20
|
+
list << content_tag(:li, li_content, wrapper_tag_options(item))
|
21
|
+
end
|
22
|
+
|
23
|
+
content_tag(:ul, safe_join(list))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "simpler_navigation/configuration"
|
4
|
+
require "simpler_navigation/item"
|
5
|
+
require "simpler_navigation/railtie"
|
6
|
+
require "simpler_navigation/renderers/breadcrumb"
|
7
|
+
require "simpler_navigation/renderers/list"
|
8
|
+
require "simpler_navigation/version"
|
9
|
+
|
10
|
+
module SimplerNavigation
|
11
|
+
class Error < StandardError; end
|
12
|
+
|
13
|
+
class << self
|
14
|
+
attr_accessor :config
|
15
|
+
attr_accessor :request_fullpath
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/simpler_navigation/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "simpler_navigation"
|
7
|
+
spec.version = SimplerNavigation::VERSION
|
8
|
+
spec.authors = ["Nick Muerdter"]
|
9
|
+
spec.email = ["12112+GUI@users.noreply.github.com"]
|
10
|
+
|
11
|
+
spec.summary = "A Rails gem to handle navigation menus and breadcrumbs."
|
12
|
+
spec.homepage = "https://github.com/GUI/simpler_navigation"
|
13
|
+
spec.license = "MIT"
|
14
|
+
spec.required_ruby_version = ">= 2.6.0"
|
15
|
+
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/GUI/simpler_navigation"
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/GUI/simpler_navigation/blob/main/CHANGELOG.md"
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(__dir__) do
|
23
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
24
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
|
25
|
+
end
|
26
|
+
end
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
spec.add_dependency "actionview"
|
32
|
+
spec.add_dependency "railties"
|
33
|
+
|
34
|
+
# For more information and examples about making a new gem, check out our
|
35
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: simpler_navigation
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nick Muerdter
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-03-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: actionview
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: railties
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- 12112+GUI@users.noreply.github.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".standard.yml"
|
49
|
+
- CHANGELOG.md
|
50
|
+
- Gemfile
|
51
|
+
- Gemfile.lock
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- lib/simpler_navigation.rb
|
56
|
+
- lib/simpler_navigation/configuration.rb
|
57
|
+
- lib/simpler_navigation/item.rb
|
58
|
+
- lib/simpler_navigation/railtie.rb
|
59
|
+
- lib/simpler_navigation/renderers/base.rb
|
60
|
+
- lib/simpler_navigation/renderers/breadcrumb.rb
|
61
|
+
- lib/simpler_navigation/renderers/list.rb
|
62
|
+
- lib/simpler_navigation/version.rb
|
63
|
+
- lib/simpler_navigation/view_helpers.rb
|
64
|
+
- sig/simpler_navigation.rbs
|
65
|
+
- simpler_navigation.gemspec
|
66
|
+
homepage: https://github.com/GUI/simpler_navigation
|
67
|
+
licenses:
|
68
|
+
- MIT
|
69
|
+
metadata:
|
70
|
+
homepage_uri: https://github.com/GUI/simpler_navigation
|
71
|
+
source_code_uri: https://github.com/GUI/simpler_navigation
|
72
|
+
changelog_uri: https://github.com/GUI/simpler_navigation/blob/main/CHANGELOG.md
|
73
|
+
post_install_message:
|
74
|
+
rdoc_options: []
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 2.6.0
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
requirements: []
|
88
|
+
rubygems_version: 3.4.6
|
89
|
+
signing_key:
|
90
|
+
specification_version: 4
|
91
|
+
summary: A Rails gem to handle navigation menus and breadcrumbs.
|
92
|
+
test_files: []
|