Skip to content

Commit

Permalink
Refactored menu items to make use of the item helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
bkuhlmann committed Jan 12, 2015
1 parent b5dc154 commit 02ae891
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/navigator/menu.rb
Expand Up @@ -30,14 +30,12 @@ def link content = nil, url, attributes: {}, activator: menu_activator, &block
end

def item content = nil, url, item_attributes: {}, link_attributes: {}, activator: menu_activator, &block
link_attributes.reverse_merge! href: url

if link_attributes[:href] == activator.search_value
if url == activator.search_value
item_attributes[activator.target_key] = activator.target_value
end

add "li", attributes: item_attributes, activator: activator do
add "a", content, attributes: link_attributes, activator: Navigator::TagActivator.new, &block
link content, url, attributes: link_attributes, activator: Navigator::TagActivator.new, &block
end
end

Expand Down

0 comments on commit 02ae891

Please sign in to comment.