simpler_navigation 0.1.4 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 898421e7c748a8dd8c8f9f72ae5d37b358c91b66603b9e2691e0681f10e1b496
4
- data.tar.gz: 9bdc4a5b4d05f8d7cf9c082eca9b1e7064a348a4744439c3961d0ef8f46faa17
3
+ metadata.gz: 17005023a740a755f9087a321deb827895193f83f93ee1c2937ac3528ec61a99
4
+ data.tar.gz: 9f7e5da8d8fcbc5488e938381617973f507ccd4b0062d074e9a652533bd2d7d0
5
5
  SHA512:
6
- metadata.gz: 558244e08471d58117e363d2bcd65b449692a28a7114f070d2fd1b0388f124b4b50b48d4b567ae6b1640a580f7ca19b19fdf016a687e7fa3c307b9ffc5326b65
7
- data.tar.gz: ea12d233decd28eefba17be1bf82b7d7af7b9656b5c5f6b01ff932a233dbbe831103fde538f394817beb4a65599fa4035cf0a44f46523601bb4ab83d5f42acf0
6
+ metadata.gz: 9cb0a7b23440a2bfca1d5efd435b10566b75ea1a596e96343bfca3c4e6815d7e956287a3a53f4c4c27b3e72c519209a9f7b51acbc79e7d3ca371bca271591e50
7
+ data.tar.gz: 2ff47480a7f5ddec9f55cea3d5f925cb4197002b410a17ea80ba171daea7a11a93e68004c242004cb476da601ad23c7ad91e4b84a2b60ecd7c09157b3b7215ca
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simpler_navigation (0.1.4)
4
+ simpler_navigation (0.1.6)
5
5
  actionview
6
6
  railties
7
7
 
@@ -7,6 +7,10 @@ module SimplerNavigation
7
7
  include ActionView::Helpers::UrlHelper
8
8
  include ActionView::Helpers::OutputSafetyHelper
9
9
 
10
+ attr_reader :context
11
+ attr_reader :item
12
+ attr_reader :options
13
+
10
14
  def initialize(context, item, options = {})
11
15
  @selected = {}
12
16
  @active_leaf = {}
@@ -16,6 +20,8 @@ module SimplerNavigation
16
20
  @item = item
17
21
  @options = options
18
22
 
23
+ @options[:level] ||= :all
24
+
19
25
  @request_fullpath = context.request.fullpath
20
26
  if @options[:request_fullpath]
21
27
  @request_fullpath = @options[:request_fullpath]
@@ -119,7 +125,7 @@ module SimplerNavigation
119
125
  when Regexp
120
126
  selected = item.options[:highlights_on].match?(@request_fullpath)
121
127
  when Proc
122
- selected = item.options[:highlights_on].call
128
+ selected = item.options[:highlights_on].call(self)
123
129
  else
124
130
  item_url_path = url_path(item.url).downcase
125
131
  selected = @request_fullpath.downcase.start_with?(item_url_path)
@@ -150,7 +156,7 @@ module SimplerNavigation
150
156
 
151
157
  show = true
152
158
  if !item.options[:if].nil?
153
- show = item.options[:if].call
159
+ show = item.options[:if].call(self)
154
160
  elsif !item.options[:unless].nil?
155
161
  show = !item.options[:unless].call
156
162
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimplerNavigation
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.6"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simpler_navigation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Muerdter