Make the menu html serializer pass LI items through as-is (allows for separators), issue github 55, thanks Jonathan Bohren
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.4.1-alpha.2+timestamp.2013.02.08.13.01.03
|
Version 2.4.1-alpha.2+timestamp.2013.02.10.17.11.46
|
||||||
|
|||||||
+29
-26
@@ -2328,34 +2328,37 @@ class MENU(DIV):
|
|||||||
else:
|
else:
|
||||||
ul = UL(_class=self['ul_class'])
|
ul = UL(_class=self['ul_class'])
|
||||||
for item in data:
|
for item in data:
|
||||||
(name, active, link) = item[:3]
|
if isinstance(item,LI):
|
||||||
if isinstance(link, DIV):
|
ul.append(item)
|
||||||
li = LI(link)
|
|
||||||
elif 'no_link_url' in self.attributes and self['no_link_url'] == link:
|
|
||||||
li = LI(DIV(name))
|
|
||||||
elif isinstance(link,dict):
|
|
||||||
li = LI(A(name, **link))
|
|
||||||
elif link:
|
|
||||||
li = LI(A(name, _href=link))
|
|
||||||
elif not link and isinstance(name, A):
|
|
||||||
li = LI(name)
|
|
||||||
else:
|
else:
|
||||||
li = LI(A(name, _href='#',
|
(name, active, link) = item[:3]
|
||||||
_onclick='javascript:void(0);return false;'))
|
if isinstance(link, DIV):
|
||||||
if level == 0 and item == data[0]:
|
li = LI(link)
|
||||||
li['_class'] = self['li_first']
|
elif 'no_link_url' in self.attributes and self['no_link_url'] == link:
|
||||||
elif level == 0 and item == data[-1]:
|
li = LI(DIV(name))
|
||||||
li['_class'] = self['li_last']
|
elif isinstance(link,dict):
|
||||||
if len(item) > 3 and item[3]:
|
li = LI(A(name, **link))
|
||||||
li['_class'] = self['li_class']
|
elif link:
|
||||||
li.append(self.serialize(item[3], level + 1))
|
li = LI(A(name, _href=link))
|
||||||
if active or ('active_url' in self.attributes and self['active_url'] == link):
|
elif not link and isinstance(name, A):
|
||||||
if li['_class']:
|
li = LI(name)
|
||||||
li['_class'] = li['_class'] + ' ' + self['li_active']
|
|
||||||
else:
|
else:
|
||||||
li['_class'] = self['li_active']
|
li = LI(A(name, _href='#',
|
||||||
if len(item) <= 4 or item[4] == True:
|
_onclick='javascript:void(0);return false;'))
|
||||||
ul.append(li)
|
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))
|
||||||
|
if active or ('active_url' in self.attributes and self['active_url'] == link):
|
||||||
|
if li['_class']:
|
||||||
|
li['_class'] = li['_class'] + ' ' + self['li_active']
|
||||||
|
else:
|
||||||
|
li['_class'] = self['li_active']
|
||||||
|
if len(item) <= 4 or item[4] == True:
|
||||||
|
ul.append(li)
|
||||||
return ul
|
return ul
|
||||||
|
|
||||||
def serialize_mobile(self, data, select=None, prefix=''):
|
def serialize_mobile(self, data, select=None, prefix=''):
|
||||||
|
|||||||
Reference in New Issue
Block a user