diff --git a/VERSION b/VERSION index c6fd2217..b9dec6b5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.2.1 (2012-12-03 14:27:15) stable +Version 2.2.1 (2012-12-03 14:41:44) stable diff --git a/gluon/html.py b/gluon/html.py index ccc314e4..91f9c259 100644 --- a/gluon/html.py +++ b/gluon/html.py @@ -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))