MENU(li_first, li_last..), fixed issue 1200, thanks dev to null

This commit is contained in:
mdipierro
2012-12-03 14:42:37 -06:00
parent f6c1ae20c9
commit ca18d164e3
2 changed files with 11 additions and 1 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.2.1 (2012-12-03 14:27:15) stable
Version 2.2.1 (2012-12-03 14:41:44) stable
+10
View File
@@ -2292,6 +2292,8 @@ class MENU(DIV):
_class: defaults to 'web2py-menu web2py-menu-vertical'
ul_class: defaults to 'web2py-menu-vertical'
li_class: defaults to 'web2py-menu-expand'
li_first: defaults to 'web2py-menu-first'
li_last: defaults to 'web2py-menu-last'
Example:
menu = MENU([['name', False, URL(...), [submenu]], ...])
@@ -2310,6 +2312,10 @@ class MENU(DIV):
self['ul_class'] = 'web2py-menu-vertical'
if not 'li_class' in self.attributes:
self['li_class'] = 'web2py-menu-expand'
if not 'li_first' in self.attributes:
self['li_first'] = 'web2py-menu-first'
if not 'li_last' in self.attributes:
self['li_last'] = 'web2py-menu-last'
if not 'li_active' in self.attributes:
self['li_active'] = 'web2py-menu-active'
if not 'mobile' in self.attributes:
@@ -2335,6 +2341,10 @@ class MENU(DIV):
else:
li = LI(A(name, _href='#',
_onclick='javascript:void(0);return false;'))
if level == 0 and item == data[0]:
li['_class'] = self['li_first']
elif level == 0 and item == data[-1]:
li['_class'] = self['li_last']
if len(item) > 3 and item[3]:
li['_class'] = self['li_class']
li.append(self.serialize(item[3], level + 1))