Commit fc839045 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

Add submenu

parent 833b4dfd
......@@ -147,7 +147,7 @@ def get_services(request):
return HttpResponse(content=data, mimetype=mimetype)
def get_menu(request, with_extra_links=False, with_signout=True):
def get_menu(request, with_extra_links=True, with_signout=True):
user = request.user
if not isinstance(user, AstakosUser):
cookie = unquote(request.COOKIES.get(COOKIE_NAME, ''))
......@@ -271,9 +271,22 @@ class MenuItem(dict):
def __set_is_active__(self):
if self.get('is_active'):
if self.current_path == self.get('url'):
self.__setitem__('is_active', True)
urls = [d.get('url') for d in self.get('submenu', ())]
if self.current_path in urls:
submenu = self.get('submenu', ())
current = (i for i in submenu if i.get('url') == self.current_path)
current_node =
if not current_node.get('is_active'):
current_node.__setitem__('is_active', True)
self.__setitem__('is_active', True)
except StopIteration:
def __setattribute__(self, name, value):
super(MenuItem, self).__setattribute__(name, value)
if name == 'current_path':
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment