MENU(li_first, li_last..), fixed issue 1200, thanks dev to null
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.2.1 (2012-12-03 14:27:15) stable
|
Version 2.2.1 (2012-12-03 14:41:44) stable
|
||||||
|
|||||||
@@ -2292,6 +2292,8 @@ class MENU(DIV):
|
|||||||
_class: defaults to 'web2py-menu web2py-menu-vertical'
|
_class: defaults to 'web2py-menu web2py-menu-vertical'
|
||||||
ul_class: defaults to 'web2py-menu-vertical'
|
ul_class: defaults to 'web2py-menu-vertical'
|
||||||
li_class: defaults to 'web2py-menu-expand'
|
li_class: defaults to 'web2py-menu-expand'
|
||||||
|
li_first: defaults to 'web2py-menu-first'
|
||||||
|
li_last: defaults to 'web2py-menu-last'
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
menu = MENU([['name', False, URL(...), [submenu]], ...])
|
menu = MENU([['name', False, URL(...), [submenu]], ...])
|
||||||
@@ -2310,6 +2312,10 @@ class MENU(DIV):
|
|||||||
self['ul_class'] = 'web2py-menu-vertical'
|
self['ul_class'] = 'web2py-menu-vertical'
|
||||||
if not 'li_class' in self.attributes:
|
if not 'li_class' in self.attributes:
|
||||||
self['li_class'] = 'web2py-menu-expand'
|
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:
|
if not 'li_active' in self.attributes:
|
||||||
self['li_active'] = 'web2py-menu-active'
|
self['li_active'] = 'web2py-menu-active'
|
||||||
if not 'mobile' in self.attributes:
|
if not 'mobile' in self.attributes:
|
||||||
@@ -2335,6 +2341,10 @@ class MENU(DIV):
|
|||||||
else:
|
else:
|
||||||
li = LI(A(name, _href='#',
|
li = LI(A(name, _href='#',
|
||||||
_onclick='javascript:void(0);return false;'))
|
_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]:
|
if len(item) > 3 and item[3]:
|
||||||
li['_class'] = self['li_class']
|
li['_class'] = self['li_class']
|
||||||
li.append(self.serialize(item[3], level + 1))
|
li.append(self.serialize(item[3], level + 1))
|
||||||
|
|||||||
Reference in New Issue
Block a user