navigator 5.5.0 → 6.0.3
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
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +5 -2
- data/app/helpers/navigator/navigation_helper.rb +2 -6
- data/lib/navigator/identity.rb +2 -2
- data/lib/navigator/menu.rb +32 -14
- data/lib/navigator/tag.rb +8 -16
- data.tar.gz.sig +0 -0
- metadata +16 -16
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92e2a3089d84e37618c07782aa36a193a29d689bdb9d34c40e0bebd210e779bb
|
4
|
+
data.tar.gz: 3c756422dfb30e9056bb72e7a09445d17f937a91fbe2063718de0969cb913474
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e314d21ad031166736a41b236104bc4cec6fff786af20215c142c62a3ea8ef7a80e85b36da351cb32937ff2235bc8617efe87b747616c86d821161f3591675b1
|
7
|
+
data.tar.gz: ac4a00e5ad611bb456c5b5f6ecd1d5542d8ecb3cfe8e26bf3f5b719e01e55e6656206e77330d77ddf5ac7be0653a635ca1b564feb8adf7a7c8c970b6514b8dca
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -11,7 +11,10 @@ image::https://img.shields.io/badge/code_style-alchemists-brightgreen.svg[Alchem
|
|
11
11
|
[link=https://circleci.com/gh/bkuhlmann/navigator]
|
12
12
|
image::https://circleci.com/gh/bkuhlmann/navigator.svg?style=svg[Circle CI Status]
|
13
13
|
|
14
|
-
|
14
|
+
Navigator is a Rails Engine that provides a domain specific language for menu navigation. Great for
|
15
|
+
situations in which you need dynamic, server-side, rendering of site navigation menus complete with
|
16
|
+
active page highlighting. You can also style your navigation menus with plain CSS or any CSS
|
17
|
+
framework of your choice.
|
15
18
|
|
16
19
|
toc::[]
|
17
20
|
|
@@ -349,7 +352,7 @@ Result:
|
|
349
352
|
</nav>
|
350
353
|
----
|
351
354
|
|
352
|
-
This is the default behavior for all navigation menus and is how menu items
|
355
|
+
This is the default behavior for all navigation menus and is how menu items automatically get the
|
353
356
|
"`active`" class when the item URL (in this case "`/home`") matches the `+request.env[“PATH_INFO"]+`
|
354
357
|
to indicate current page/active tab.
|
355
358
|
|
@@ -13,12 +13,8 @@ module Navigator
|
|
13
13
|
|
14
14
|
module_function
|
15
15
|
|
16
|
-
def current_path
|
17
|
-
request.env["PATH_INFO"]
|
18
|
-
end
|
16
|
+
def current_path = request.env["PATH_INFO"]
|
19
17
|
|
20
|
-
def navigation_activator
|
21
|
-
Navigator::TagActivator.new search_value: current_path
|
22
|
-
end
|
18
|
+
def navigation_activator = Navigator::TagActivator.new(search_value: current_path)
|
23
19
|
end
|
24
20
|
end
|
data/lib/navigator/identity.rb
CHANGED
data/lib/navigator/menu.rb
CHANGED
@@ -3,11 +3,33 @@
|
|
3
3
|
module Navigator
|
4
4
|
# Renders a HTML menu.
|
5
5
|
class Menu
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
ALLOWED_ELEMENTS = /
|
7
|
+
^(
|
8
|
+
div|
|
9
|
+
section|
|
10
|
+
header|
|
11
|
+
h[1-6]|
|
12
|
+
nav|
|
13
|
+
ul|
|
14
|
+
li|
|
15
|
+
a|
|
16
|
+
img|
|
17
|
+
b|
|
18
|
+
em|
|
19
|
+
s|
|
20
|
+
small|
|
21
|
+
span|
|
22
|
+
strong|
|
23
|
+
sub|
|
24
|
+
sup|
|
25
|
+
form|
|
26
|
+
label|
|
27
|
+
select|
|
28
|
+
option|
|
29
|
+
input|
|
30
|
+
button
|
31
|
+
)$
|
32
|
+
/x
|
11
33
|
|
12
34
|
def initialize template,
|
13
35
|
tag: "ul",
|
@@ -62,25 +84,21 @@ module Navigator
|
|
62
84
|
end
|
63
85
|
end
|
64
86
|
|
65
|
-
def method_missing name, *
|
87
|
+
def method_missing name, *positionals, **keywords, &block
|
66
88
|
if respond_to_missing? name
|
67
|
-
add(name, *
|
89
|
+
add(name, *positionals, **keywords, &block)
|
68
90
|
else
|
69
|
-
template.public_send(name, *
|
91
|
+
template.public_send(name, *positionals, **keywords) || super
|
70
92
|
end
|
71
93
|
end
|
72
94
|
|
73
|
-
def render
|
74
|
-
[tag.prefix, tag.content, items.compact.join, tag.suffix].compact.join
|
75
|
-
end
|
95
|
+
def render = [tag.prefix, tag.content, items.compact.join, tag.suffix].compact.join
|
76
96
|
|
77
97
|
private
|
78
98
|
|
79
99
|
attr_accessor :template, :tag, :menu_activator, :items
|
80
100
|
|
81
|
-
def respond_to_missing?
|
82
|
-
self.class.allowed_methods.match?(name) || super
|
83
|
-
end
|
101
|
+
def respond_to_missing?(name, include_private = false) = ALLOWED_ELEMENTS.match?(name) || super
|
84
102
|
|
85
103
|
def activate_item_attributes! attributes, url, activator
|
86
104
|
return unless url == activator.search_value
|
data/lib/navigator/tag.rb
CHANGED
@@ -5,9 +5,7 @@ module Navigator
|
|
5
5
|
class Tag
|
6
6
|
attr_reader :name, :content
|
7
7
|
|
8
|
-
def self.names_without_suffix
|
9
|
-
%w[img input]
|
10
|
-
end
|
8
|
+
def self.names_without_suffix = %w[img input]
|
11
9
|
|
12
10
|
# rubocop:disable Metrics/ParameterLists
|
13
11
|
def initialize name, content = nil, attributes: {}, activator: Navigator::TagActivator.new
|
@@ -18,21 +16,13 @@ module Navigator
|
|
18
16
|
end
|
19
17
|
# rubocop:enable Metrics/ParameterLists
|
20
18
|
|
21
|
-
def prefix
|
22
|
-
["<#{name}", format_attributes, ">"].compact * ""
|
23
|
-
end
|
19
|
+
def prefix = ["<#{name}", format_attributes, ">"].compact.join
|
24
20
|
|
25
|
-
def computed_content
|
26
|
-
self.class.names_without_suffix.include?(name) ? nil : content
|
27
|
-
end
|
21
|
+
def computed_content = self.class.names_without_suffix.include?(name) ? nil : content
|
28
22
|
|
29
|
-
def suffix
|
30
|
-
self.class.names_without_suffix.include?(name) ? nil : "</#{name}>"
|
31
|
-
end
|
23
|
+
def suffix = self.class.names_without_suffix.include?(name) ? nil : "</#{name}>"
|
32
24
|
|
33
|
-
def render
|
34
|
-
[prefix, computed_content, suffix].compact * ""
|
35
|
-
end
|
25
|
+
def render = [prefix, computed_content, suffix].compact.join
|
36
26
|
|
37
27
|
private
|
38
28
|
|
@@ -45,7 +35,9 @@ module Navigator
|
|
45
35
|
end
|
46
36
|
|
47
37
|
def concatenate_attributes attrs
|
48
|
-
activator.activate(attrs)
|
38
|
+
activator.activate(attrs)
|
39
|
+
.map { |key, value| %(#{key}="#{value}") }
|
40
|
+
.join(" ")
|
49
41
|
end
|
50
42
|
|
51
43
|
def format_attributes
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: navigator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -10,9 +10,9 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIC/
|
14
|
-
|
15
|
-
|
13
|
+
MIIC/jCCAeagAwIBAgIBBDANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
|
14
|
+
a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMTAzMTkxMjQ4MDZaFw0yMjAzMTkx
|
15
|
+
MjQ4MDZaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
|
16
16
|
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6l1qpXTiomH1RfMRloyw7MiE
|
17
17
|
xyVx/x8Yc3EupdH7uhNaTXQGyORN6aOY//1QXXMHIZ9tW74nZLhesWMSUMYy0XhB
|
18
18
|
brs+KkurHnc9FnEJAbG7ebGvl/ncqZt72nQvaxpDxvuCBHgJAz+8i5wl6FhLw+oT
|
@@ -20,15 +20,15 @@ cert_chain:
|
|
20
20
|
D5vkU0YlAm1r98BymuJlcQ1qdkVEI1d48ph4kcS0S0nv1RiuyVb6TCAR3Nu3VaVq
|
21
21
|
3fPzZKJLZBx67UvXdbdicWPiUR75elI4PXpLIic3xytaF52ZJYyKZCNZJhNwfQID
|
22
22
|
AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU0nzow9vc
|
23
|
-
2CdikiiE3fJhP/
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBAEjpaOXHHp8s/7GL2qCb
|
24
|
+
YAs7urOLv9VHSPfQWAwaTMVnSsIf3Sw4xzISOP/mmfEPBPXtz61K5esrE/uTFtgb
|
25
|
+
FyjxQk2H0sEWgrRXGGNHBWQRhhEs7LP/TByoC15A0br++xLxRz4r7HBLGAWQQDpg
|
26
|
+
66BJ2TBVjxS6K64tKbq7+ACyrOZGgTfNHACh4M076y0x0oRf/rwBrU39/KRfuhbb
|
27
|
+
cm+nNCEtO35gTmZ2bVDHLGvWazi3gJt6+huQjfXTCUUG2YYBxwhu+GPdAGQPxpf9
|
28
|
+
lkHilIrX69jq8wMPpBhlaw2mRmeSL50Wv5u6xVBvOHhXFSP1crXM95vfLhLyRYod
|
29
|
+
W2A=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date:
|
31
|
+
date: 2021-09-05 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rails
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '8.0'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '8.0'
|
61
61
|
description:
|
62
62
|
email:
|
63
63
|
- brooke@alchemists.io
|
@@ -92,14 +92,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
95
|
+
version: '3.0'
|
96
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
97
|
requirements:
|
98
98
|
- - ">="
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
|
-
rubygems_version: 3.2.
|
102
|
+
rubygems_version: 3.2.27
|
103
103
|
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: Enhances Rails with a DSL for menu navigation.
|
metadata.gz.sig
CHANGED
Binary file
|