simpler_navigation 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/simpler_navigation/renderers/base.rb +10 -21
- data/lib/simpler_navigation/version.rb +1 -1
- data/lib/simpler_navigation.rb +0 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 898421e7c748a8dd8c8f9f72ae5d37b358c91b66603b9e2691e0681f10e1b496
|
4
|
+
data.tar.gz: 9bdc4a5b4d05f8d7cf9c082eca9b1e7064a348a4744439c3961d0ef8f46faa17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 558244e08471d58117e363d2bcd65b449692a28a7114f070d2fd1b0388f124b4b50b48d4b567ae6b1640a580f7ca19b19fdf016a687e7fa3c307b9ffc5326b65
|
7
|
+
data.tar.gz: ea12d233decd28eefba17be1bf82b7d7af7b9656b5c5f6b01ff932a233dbbe831103fde538f394817beb4a65599fa4035cf0a44f46523601bb4ab83d5f42acf0
|
data/Gemfile.lock
CHANGED
@@ -16,6 +16,11 @@ module SimplerNavigation
|
|
16
16
|
@item = item
|
17
17
|
@options = options
|
18
18
|
|
19
|
+
@request_fullpath = context.request.fullpath
|
20
|
+
if @options[:request_fullpath]
|
21
|
+
@request_fullpath = @options[:request_fullpath]
|
22
|
+
end
|
23
|
+
|
19
24
|
if @item.nil?
|
20
25
|
case @options[:level]
|
21
26
|
when :all
|
@@ -112,14 +117,12 @@ module SimplerNavigation
|
|
112
117
|
selected = false
|
113
118
|
case item.options[:highlights_on]
|
114
119
|
when Regexp
|
115
|
-
selected = item.options[:highlights_on].match?(
|
120
|
+
selected = item.options[:highlights_on].match?(@request_fullpath)
|
116
121
|
when Proc
|
117
122
|
selected = item.options[:highlights_on].call
|
118
123
|
else
|
119
|
-
|
120
|
-
|
121
|
-
selected = SimplerNavigation.request_fullpath.downcase.start_with?(item_url_path)
|
122
|
-
end
|
124
|
+
item_url_path = url_path(item.url).downcase
|
125
|
+
selected = @request_fullpath.downcase.start_with?(item_url_path)
|
123
126
|
end
|
124
127
|
|
125
128
|
selected ||= item.children.any? do |key, value|
|
@@ -147,23 +150,9 @@ module SimplerNavigation
|
|
147
150
|
|
148
151
|
show = true
|
149
152
|
if !item.options[:if].nil?
|
150
|
-
show =
|
151
|
-
when false
|
152
|
-
false
|
153
|
-
when true
|
154
|
-
true
|
155
|
-
else
|
156
|
-
item.options[:if].call
|
157
|
-
end
|
153
|
+
show = item.options[:if].call
|
158
154
|
elsif !item.options[:unless].nil?
|
159
|
-
show =
|
160
|
-
when false
|
161
|
-
true
|
162
|
-
when true
|
163
|
-
false
|
164
|
-
else
|
165
|
-
!item.options[:unless].call
|
166
|
-
end
|
155
|
+
show = !item.options[:unless].call
|
167
156
|
end
|
168
157
|
|
169
158
|
@show[item] = show
|
data/lib/simpler_navigation.rb
CHANGED