Skip to content
Snippets Groups Projects
Unverified Commit 4d8d3be8 authored by Milton Lenis's avatar Milton Lenis Committed by GitHub
Browse files

Merge pull request #7 from lucaskuzma/master

checks if url is substring of path for root items
parents 4f2bd253 60d02995
No related branches found
No related tags found
No related merge requests found
......@@ -82,10 +82,20 @@ class MenuBase(object):
def _is_selected(self, item_dict):
"""
Given a menu item dictionary, it returns true if `url` is on path.
Given a menu item dictionary, it returns true if `url` is on path,
unless the item is marked as a root, in which case returns true if `url` is part of path.
"""
url = self._get_url(item_dict)
return url == self.path
if self._is_root(item_dict):
return url in self.path
else:
return url == self.path
def _is_root(self, item_dict):
"""
Given a menu item dictionary, it returns true if item is marked as a `root`.
"""
return item_dict.get('root', False)
def _process_breadcrums(self, menu_list):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment