simple-navigation 3.12.0 → 3.12.1

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.
Files changed (30) hide show
  1. data/CHANGELOG +4 -0
  2. data/generators/navigation_config/navigation_config_generator.rb +3 -3
  3. data/generators/navigation_config/templates/config/navigation.rb +9 -10
  4. data/init.rb +1 -1
  5. data/lib/generators/navigation_config/navigation_config_generator.rb +11 -6
  6. data/lib/simple-navigation.rb +1 -1
  7. data/lib/simple_navigation.rb +93 -65
  8. data/lib/simple_navigation/adapters/base.rb +16 -16
  9. data/lib/simple_navigation/adapters/nanoc.rb +7 -6
  10. data/lib/simple_navigation/adapters/padrino.rb +5 -7
  11. data/lib/simple_navigation/adapters/rails.rb +52 -39
  12. data/lib/simple_navigation/adapters/sinatra.rb +14 -17
  13. data/lib/simple_navigation/core/configuration.rb +73 -34
  14. data/lib/simple_navigation/core/item.rb +110 -54
  15. data/lib/simple_navigation/core/item_adapter.rb +18 -13
  16. data/lib/simple_navigation/core/item_container.rb +93 -66
  17. data/lib/simple_navigation/core/items_provider.rb +12 -10
  18. data/lib/simple_navigation/rails_controller_methods.rb +98 -78
  19. data/lib/simple_navigation/rendering/helpers.rb +130 -68
  20. data/lib/simple_navigation/rendering/renderer/base.rb +30 -25
  21. data/lib/simple_navigation/rendering/renderer/breadcrumbs.rb +26 -19
  22. data/lib/simple_navigation/rendering/renderer/json.rb +11 -13
  23. data/lib/simple_navigation/rendering/renderer/links.rb +18 -13
  24. data/lib/simple_navigation/rendering/renderer/list.rb +28 -15
  25. data/lib/simple_navigation/rendering/renderer/text.rb +7 -12
  26. data/lib/simple_navigation/version.rb +1 -1
  27. data/spec/lib/simple_navigation/core/item_adapter_spec.rb +1 -1
  28. data/spec/lib/simple_navigation/core/item_container_spec.rb +118 -68
  29. data/spec/lib/simple_navigation_spec.rb +16 -5
  30. metadata +2 -2
@@ -1,20 +1,18 @@
1
1
  module SimpleNavigation
2
2
  module Adapters
3
3
  class Padrino < Sinatra
4
-
5
4
  def self.register
6
5
  SimpleNavigation.set_env(PADRINO_ROOT, PADRINO_ENV)
7
6
  ::Padrino::Application.send(:helpers, SimpleNavigation::Helpers)
8
7
  end
9
-
10
- def link_to(name, url, options={})
8
+
9
+ def link_to(name, url, options = {})
11
10
  context.link_to(name, url, options)
12
11
  end
13
-
14
- def content_tag(type, content, options={})
12
+
13
+ def content_tag(type, content, options = {})
15
14
  context.content_tag(type, content.html_safe, options)
16
15
  end
17
-
18
16
  end
19
17
  end
20
- end
18
+ end
@@ -1,97 +1,110 @@
1
1
  module SimpleNavigation
2
2
  module Adapters
3
3
  class Rails < Base
4
-
5
4
  attr_reader :controller, :template
6
5
 
7
6
  def self.register
8
- SimpleNavigation.set_env(rails_root, rails_env)
7
+ SimpleNavigation.set_env(rails_root, rails_env)
9
8
  ActionController::Base.send(:include, SimpleNavigation::Helpers)
10
9
  SimpleNavigation::Helpers.instance_methods.each do |m|
11
10
  ActionController::Base.send(:helper_method, m.to_sym)
12
11
  end
13
12
  end
14
-
13
+
15
14
  def initialize(context)
16
15
  @controller = extract_controller_from context
17
16
  @template = template_from @controller
18
17
  @request = @template.request if @template
19
18
  end
20
-
19
+
21
20
  def request_uri
22
21
  return '' unless request
23
- return request.fullpath if request.respond_to?(:fullpath)
24
- request.request_uri
22
+
23
+ if request.respond_to?(:fullpath)
24
+ request.fullpath
25
+ else
26
+ request.request_uri
27
+ end
25
28
  end
26
-
29
+
27
30
  def request_path
28
- return '' unless request
29
- request.path
31
+ request ? request.path : ''
30
32
  end
31
-
33
+
32
34
  def context_for_eval
33
- raise 'no context set for evaluation the config file' unless template || controller
34
- template || controller
35
+ template ||
36
+ controller ||
37
+ fail('no context set for evaluation the config file')
35
38
  end
36
-
39
+
37
40
  def current_page?(url)
38
- template.current_page?(url) if template
41
+ template && template.current_page?(url)
39
42
  end
40
-
41
- def link_to(name, url, options={})
42
- template.link_to(link_title(name), url, options) if template
43
+
44
+ def link_to(name, url, options = {})
45
+ template && template.link_to(link_title(name), url, options)
43
46
  end
44
-
45
- def content_tag(type, content, options={})
46
- template.content_tag(type, html_safe(content), options) if template
47
+
48
+ def content_tag(type, content, options = {})
49
+ template && template.content_tag(type, html_safe(content), options)
47
50
  end
48
-
51
+
49
52
  protected
50
-
53
+
51
54
  def self.rails_root
52
55
  gte_rails3? ? ::Rails.root : ::RAILS_ROOT
53
56
  end
54
-
57
+
55
58
  def self.rails_env
56
59
  gte_rails3? ? ::Rails.env : ::RAILS_ENV
57
60
  end
58
-
61
+
59
62
  def self.gte_rails3?
60
63
  ::Rails::VERSION::MAJOR >= 3
61
64
  end
62
-
65
+
63
66
  def template_from(controller)
64
- controller.respond_to?(:view_context) ? controller.view_context : controller.instance_variable_get(:@template)
67
+ if controller.respond_to?(:view_context)
68
+ controller.view_context
69
+ else
70
+ controller.instance_variable_get(:@template)
71
+ end
65
72
  end
66
-
67
- # Marks the specified input as html_safe (for Rails3). Does nothing if html_safe is not defined on input.
73
+
74
+ # Marks the specified input as html_safe (for Rails3).
75
+ # Does nothing if html_safe is not defined on input.
68
76
  #
69
77
  def html_safe(input)
70
78
  input.respond_to?(:html_safe) ? input.html_safe : input
71
79
  end
72
-
80
+
73
81
  # Extracts a controller from the context.
74
82
  def extract_controller_from(context)
75
- context.respond_to?(:controller) ?
76
- context.controller || context :
83
+ if context.respond_to?(:controller)
84
+ context.controller || context
85
+ else
77
86
  context
87
+ end
78
88
  end
79
89
 
80
- def link_title name
81
- SimpleNavigation.config.consider_item_names_as_safe ? html_safe(name) : name
90
+ def link_title(name)
91
+ if SimpleNavigation.config.consider_item_names_as_safe
92
+ html_safe(name)
93
+ else
94
+ name
95
+ end
82
96
  end
83
-
84
97
  end
85
98
  end
86
99
  end
87
100
 
88
101
  # Initializer for Rails3
89
102
  if defined?(Rails) && SimpleNavigation::Adapters::Rails.gte_rails3?
90
- module SimpleNavigation
91
- class Railtie < Rails::Railtie
92
- initializer "simple_navigation.register" do |app|
103
+ module SimpleNavigation
104
+ class Railtie < Rails::Railtie
105
+ initializer 'simple_navigation.register' do |app|
93
106
  SimpleNavigation.register
94
- end
95
- end
107
+ end
108
+ end
96
109
  end
97
110
  end
@@ -3,7 +3,6 @@ require 'cgi'
3
3
  module SimpleNavigation
4
4
  module Adapters
5
5
  class Sinatra < Base
6
-
7
6
  def self.register
8
7
  SimpleNavigation.set_env(sinatra_root, sinatra_environment)
9
8
  ::Sinatra::Application.send(:helpers, SimpleNavigation::Helpers)
@@ -15,8 +14,7 @@ module SimpleNavigation
15
14
  end
16
15
 
17
16
  def context_for_eval
18
- raise 'no context set for evaluation the config file' unless context
19
- context
17
+ context || fail('no context set for evaluation the config file')
20
18
  end
21
19
 
22
20
  def request_uri
@@ -29,24 +27,24 @@ module SimpleNavigation
29
27
 
30
28
  def current_page?(url)
31
29
  url_string = CGI.unescape(url)
32
- if url_string.index("?")
33
- uri = request_uri
34
- else
35
- uri = request_uri.split('?').first
36
- end
37
- uri = CGI.unescape(uri)
38
- if url_string =~ /^\w+:\/\//
39
- url_string == "#{request.scheme}://#{request.host_with_port}#{uri}"
40
- else
41
- url_string == uri
30
+ uri = if url_string.index('?')
31
+ request_uri
32
+ else
33
+ request_uri.split('?').first
34
+ end
35
+
36
+ if url_string =~ %r(^\w+://)
37
+ uri = "#{request.scheme}://#{request.host_with_port}#{uri}"
42
38
  end
39
+
40
+ url_string == CGI.unescape(uri)
43
41
  end
44
42
 
45
- def link_to(name, url, options={})
43
+ def link_to(name, url, options = {})
46
44
  "<a href='#{url}'#{to_attributes(options)}>#{name}</a>"
47
45
  end
48
46
 
49
- def content_tag(type, content, options={})
47
+ def content_tag(type, content, options = {})
50
48
  "<#{type}#{to_attributes(options)}>#{content}</#{type}>"
51
49
  end
52
50
 
@@ -61,9 +59,8 @@ module SimpleNavigation
61
59
  end
62
60
 
63
61
  def to_attributes(options)
64
- options.map {|k, v| v.nil? ? '' : " #{k}='#{v}'"}.join
62
+ options.map { |k, v| v.nil? ? '' : " #{k}='#{v}'" }.join
65
63
  end
66
-
67
64
  end
68
65
  end
69
66
  end
@@ -1,47 +1,65 @@
1
1
  require 'singleton'
2
2
 
3
3
  module SimpleNavigation
4
-
5
4
  # Responsible for evaluating and handling the config/navigation.rb file.
6
5
  class Configuration
7
6
  include Singleton
8
7
 
9
- attr_accessor :renderer, :selected_class, :active_leaf_class, :autogenerate_item_ids, :id_generator, :auto_highlight, :name_generator, :consider_item_names_as_safe
10
- attr_reader :primary_navigation
8
+ attr_accessor :autogenerate_item_ids,
9
+ :auto_highlight,
10
+ :consider_item_names_as_safe
11
11
 
12
- class << self
12
+ attr_reader :primary_navigation
13
13
 
14
- # Evals the config_file for the given navigation_context
15
- def eval_config(navigation_context = :default)
16
- SimpleNavigation.context_for_eval.instance_eval(SimpleNavigation.config_files[navigation_context])
17
- end
14
+ attr_writer :active_leaf_class,
15
+ :id_generator,
16
+ :name_generator,
17
+ :renderer,
18
+ :selected_class
18
19
 
19
- # Starts processing the configuration
20
- def run(&block)
21
- block.call Configuration.instance
22
- end
20
+ # Evals the config_file for the given navigation_context
21
+ def self.eval_config(navigation_context = :default)
22
+ context = SimpleNavigation.config_files[navigation_context]
23
+ SimpleNavigation.context_for_eval.instance_eval(context)
24
+ end
23
25
 
24
- end #class << self
26
+ # Starts processing the configuration
27
+ def self.run(&block)
28
+ block.call Configuration.instance
29
+ end
25
30
 
26
31
  # Sets the config's default-settings
27
32
  def initialize
28
- @renderer = SimpleNavigation.default_renderer || SimpleNavigation::Renderer::List
29
- @selected_class = 'selected'
30
- @active_leaf_class = 'simple-navigation-active-leaf'
31
33
  @autogenerate_item_ids = true
32
- @id_generator = Proc.new {|id| id.to_s }
33
- @name_generator = Proc.new {|name| name}
34
34
  @auto_highlight = true
35
35
  @consider_item_names_as_safe = true
36
+
36
37
  if defined?(ActiveSupport::Deprecation)
37
- ActiveSupport::Deprecation.warn "simple-navigation: consider_item_names_as_safe will be set to false by default in 3.13.0 release, hence item names will be considered unsafe by default. See https://github.com/codeplant/simple-navigation/wiki", caller
38
+ ActiveSupport::Deprecation.warn 'simple-navigation: ' \
39
+ 'consider_item_names_as_safe will be set to false ' \
40
+ 'by default in 3.13.0 release, hence item names ' \
41
+ 'will be considered unsafe by default. ' \
42
+ 'See https://github.com/codeplant/simple-navigation/wiki',
43
+ caller
38
44
  end
39
45
  end
40
46
 
41
- # This is the main method for specifying the navigation items. It can be used in two ways:
47
+ def active_leaf_class
48
+ @active_leaf_class ||= 'simple-navigation-active-leaf'
49
+ end
50
+
51
+ def id_generator
52
+ @id_generator ||= :to_s.to_proc
53
+ end
54
+
55
+ # This is the main method for specifying the navigation items.
56
+ # It can be used in two ways:
42
57
  #
43
- # 1. Declaratively specify your items in the config/navigation.rb file using a block. It then yields an SimpleNavigation::ItemContainer for adding navigation items.
44
- # 1. Directly provide your items to the method (e.g. when loading your items from the database).
58
+ # 1. Declaratively specify your items in the config/navigation.rb file
59
+ # using a block. It then yields an SimpleNavigation::ItemContainer
60
+ # for adding navigation items.
61
+ # 2. Directly provide your items to the method (e.g. when loading your
62
+ # items from the database).
45
63
  #
46
64
  # ==== Example for block style (configuration file)
47
65
  # config.items do |primary|
@@ -51,26 +69,47 @@ module SimpleNavigation
51
69
  #
52
70
  # ==== To consider when directly providing items
53
71
  # items_provider should be:
54
- # * a methodname (as symbol) that returns your items. The method needs to be available in the view (i.e. a helper method)
72
+ # * a methodname (as symbol) that returns your items. The method needs to
73
+ # be available in the view (i.e. a helper method)
55
74
  # * an object that responds to :items
56
75
  # * an enumerable containing your items
57
- # The items you specify have to fullfill certain requirements. See SimpleNavigation::ItemAdapter for more details.
76
+ # The items you specify have to fullfill certain requirements.
77
+ # See SimpleNavigation::ItemAdapter for more details.
58
78
  #
59
- def items(items_provider=nil, &block)
60
- raise 'please specify either items_provider or block, but not both' if (items_provider && block) || (items_provider.nil? && block.nil?)
61
- @primary_navigation = ItemContainer.new
79
+ def items(items_provider = nil, &block)
80
+ if (items_provider && block) || (items_provider.nil? && block.nil?)
81
+ fail('please specify either items_provider or block, but not both')
82
+ end
83
+
84
+ self.primary_navigation = ItemContainer.new
85
+
62
86
  if block
63
- block.call @primary_navigation
87
+ block.call primary_navigation
64
88
  else
65
- @primary_navigation.items = SimpleNavigation::ItemsProvider.new(items_provider).items
89
+ primary_navigation.items = ItemsProvider.new(items_provider).items
66
90
  end
67
91
  end
68
92
 
69
93
  # Returns true if the config_file has already been evaluated.
70
94
  def loaded?
71
- !@primary_navigation.nil?
72
- end
73
-
74
- end
75
-
95
+ !primary_navigation.nil?
96
+ end
97
+
98
+ def name_generator
99
+ @name_generator ||= proc { |name| name }
100
+ end
101
+
102
+ def renderer
103
+ @renderer ||= SimpleNavigation.default_renderer ||
104
+ SimpleNavigation::Renderer::List
105
+ end
106
+
107
+ def selected_class
108
+ @selected_class ||= 'selected'
109
+ end
110
+
111
+ private
112
+
113
+ attr_writer :primary_navigation
114
+ end
76
115
  end
@@ -1,35 +1,37 @@
1
1
  module SimpleNavigation
2
-
3
- # Represents an item in your navigation. Gets generated by the item method in the config-file.
2
+ # Represents an item in your navigation.
3
+ # Gets generated by the item method in the config-file.
4
4
  class Item
5
- attr_reader :key, :url, :sub_navigation, :method, :highlights_on
5
+ attr_reader :highlights_on,
6
+ :key,
7
+ :method,
8
+ :sub_navigation,
9
+ :url
10
+
6
11
  attr_writer :html_options
7
12
 
8
13
  # see ItemContainer#item
9
14
  #
10
- # The subnavigation (if any) is either provided by a block or passed in directly as <tt>items</tt>
11
- def initialize(container, key, name, url_or_options = {}, options_or_nil={}, items=nil, &sub_nav_block)
12
- @container = container
15
+ # The subnavigation (if any) is either provided by a block or
16
+ # passed in directly as <tt>items</tt>
17
+ def initialize(container, key, name, url_or_options = {}, options_or_nil = {}, items = nil, &sub_nav_block)
13
18
  options = setup_url_and_options(url_or_options, options_or_nil)
14
- @container.dom_class = options.delete(:container_class) if options[:container_class]
15
- @container.dom_id = options.delete(:container_id) if options[:container_id]
16
- @container.dom_attributes = options[:container_attributes] ? options.delete(:container_attributes) : {}
17
- @container.selected_class = options.delete(:selected_class) if options[:selected_class]
19
+
18
20
  @key = key
19
21
  @method = options.delete(:method)
20
22
  @name = name
21
- if sub_nav_block || items
22
- @sub_navigation = ItemContainer.new(@container.level + 1)
23
- sub_nav_block.call @sub_navigation if sub_nav_block
24
- @sub_navigation.items = items if items
25
- end
23
+ @container = setup_container(container, options)
24
+
25
+ setup_sub_navigation(items, &sub_nav_block)
26
26
  end
27
27
 
28
- # Returns the item's name. If option :apply_generator is set to true (default),
29
- # the name will be passed to the name_generator specified in the configuration.
28
+ # Returns the item's name.
29
+ # If :apply_generator option is set to true (default),
30
+ # the name will be passed to the name_generator specified
31
+ # in the configuration.
30
32
  #
31
33
  def name(options = {})
32
- options.reverse_merge!(:apply_generator => true)
34
+ options = { apply_generator: true }.merge(options)
33
35
  if (options[:apply_generator])
34
36
  SimpleNavigation.config.name_generator.call(@name, self)
35
37
  else
@@ -45,34 +47,45 @@ module SimpleNavigation
45
47
  # * its url matches the url of the current request (auto highlighting)
46
48
  #
47
49
  def selected?
48
- @selected = @selected || selected_by_config? || selected_by_subnav? || selected_by_condition?
50
+ @selected ||= selected_by_config? ||
51
+ selected_by_subnav? ||
52
+ selected_by_condition?
49
53
  end
50
54
 
51
- # Returns the html-options hash for the item, i.e. the options specified for this item in the config-file.
55
+ # Returns the html-options hash for the item, i.e. the options specified
56
+ # for this item in the config-file.
52
57
  # It also adds the 'selected' class to the list of classes if necessary.
53
58
  def html_options
54
- default_options = self.autogenerate_item_ids? ? {:id => autogenerated_item_id} : {}
55
- options = default_options.merge(@html_options)
56
- options[:class] = [@html_options[:class], self.selected_class, self.active_leaf_class].flatten.compact.join(' ')
57
- options.delete(:class) if options[:class].nil? || options[:class] == ''
59
+ options = @html_options
60
+ options[:id] ||= autogenerated_item_id if autogenerate_item_ids?
61
+
62
+ classes = [@html_options[:class], selected_class, active_leaf_class]
63
+ classes = classes.flatten.compact.join(' ')
64
+ options[:class] = classes unless classes.nil? || classes.empty?
65
+
58
66
  options
59
67
  end
60
68
 
61
69
  # Returns the configured active_leaf_class if the item is the selected leaf,
62
70
  # nil otherwise
63
71
  def active_leaf_class
64
- !selected_by_subnav? && selected_by_condition? ? SimpleNavigation.config.active_leaf_class : nil
72
+ if !selected_by_subnav? && selected_by_condition?
73
+ SimpleNavigation.config.active_leaf_class
74
+ end
65
75
  end
66
76
 
67
77
  # Returns the configured selected_class if the item is selected,
68
78
  # nil otherwise
69
79
  def selected_class
70
- selected? ? (@container.selected_class || SimpleNavigation.config.selected_class) : nil
80
+ if selected?
81
+ container.selected_class || SimpleNavigation.config.selected_class
82
+ end
71
83
  end
72
84
 
73
85
  protected
74
86
 
75
- # Returns true if item has a subnavigation and the sub_navigation is selected
87
+ # Returns true if item has a subnavigation and
88
+ # the sub_navigation is selected
76
89
  def selected_by_subnav?
77
90
  sub_navigation && sub_navigation.selected?
78
91
  end
@@ -83,22 +96,7 @@ module SimpleNavigation
83
96
 
84
97
  # Returns true if the item's url matches the request's current url.
85
98
  def selected_by_condition?
86
- if highlights_on
87
- case highlights_on
88
- when Regexp
89
- SimpleNavigation.request_uri =~ highlights_on
90
- when Proc
91
- highlights_on.call
92
- when :subpath
93
- !!(SimpleNavigation.request_uri =~ /^#{Regexp.escape url_without_anchor}(\/|$|\?)/i)
94
- else
95
- raise ArgumentError, ':highlights_on must be a Regexp, Proc or :subpath'
96
- end
97
- elsif auto_highlight?
98
- !!(root_path_match? || (url_without_anchor && SimpleNavigation.current_page?(url_without_anchor)))
99
- else
100
- false
101
- end
99
+ highlights_on ? selected_by_highlights_on? : selected_by_autohighlight?
102
100
  end
103
101
 
104
102
  # Returns true if both the item's url and the request's url are root_path
@@ -118,7 +116,7 @@ module SimpleNavigation
118
116
 
119
117
  # Return true if auto_highlight is on for this item.
120
118
  def auto_highlight?
121
- SimpleNavigation.config.auto_highlight && @container.auto_highlight
119
+ SimpleNavigation.config.auto_highlight && container.auto_highlight
122
120
  end
123
121
 
124
122
  def url_without_anchor
@@ -126,20 +124,78 @@ module SimpleNavigation
126
124
  end
127
125
 
128
126
  private
127
+
128
+ attr_reader :container
129
+
130
+ attr_writer :highlights_on,
131
+ :sub_navigation,
132
+ :url
133
+
134
+ def selected_by_autohighlight?
135
+ auto_highlight? &&
136
+ (root_path_match? ||
137
+ (url_without_anchor &&
138
+ SimpleNavigation.current_page?(url_without_anchor)))
139
+ end
140
+
141
+ def selected_by_highlights_on?
142
+ return false unless highlights_on
143
+
144
+ case highlights_on
145
+ when Regexp then SimpleNavigation.request_uri =~ highlights_on
146
+ when Proc then highlights_on.call
147
+ when :subpath
148
+ escaped_url = Regexp.escape(url_without_anchor)
149
+ !!(SimpleNavigation.request_uri =~ /^#{escaped_url}(\/|$|\?)/i)
150
+ else
151
+ fail ArgumentError, ':highlights_on must be a Regexp, Proc or :subpath'
152
+ end
153
+ end
154
+
155
+ def setup_container(container, options = {})
156
+ if options[:container_class]
157
+ container.dom_class = options.delete(:container_class)
158
+ end
159
+
160
+ if options[:container_id]
161
+ container.dom_id = options.delete(:container_id)
162
+ end
163
+
164
+ container.dom_attributes = if options[:container_attributes]
165
+ options.delete(:container_attributes)
166
+ else
167
+ {}
168
+ end
169
+
170
+ if options[:selected_class]
171
+ container.selected_class = options.delete(:selected_class)
172
+ end
173
+
174
+ container
175
+ end
176
+
129
177
  def setup_url_and_options(url_or_options, options_or_nil)
130
- options = options_or_nil
131
- url = url_or_options
132
178
  case url_or_options
133
- when Hash
134
- # url_or_options is options (there is no url)
135
- options = url_or_options
136
- when Proc
137
- @url = url.call
179
+ when Hash then options = url_or_options # there is no url
180
+ when Proc then self.url = url_or_options.call
181
+ else self.url = url_or_options
182
+ end
183
+
184
+ options ||= options_or_nil
185
+ self.highlights_on = options.delete(:highlights_on)
186
+ self.html_options = options
187
+ end
188
+
189
+ def setup_sub_navigation(items = nil, &sub_nav_block)
190
+ return unless sub_nav_block || items
191
+
192
+ self.sub_navigation = ItemContainer.new(container.level + 1)
193
+
194
+ if sub_nav_block
195
+ sub_nav_block.call sub_navigation
138
196
  else
139
- @url = url
197
+ sub_navigation.items = items
140
198
  end
141
- @highlights_on = options.delete(:highlights_on)
142
- @html_options = options
143
199
  end
144
200
  end
145
201
  end