fixed issue 1507, menu links problems with mobile user agent, thanks Paolo Valleri

This commit is contained in:
mdipierro
2013-09-02 20:43:10 -05:00
parent 6a1d83b2f4
commit 099e02fe64
2 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.6.0-development+timestamp.2013.09.02.20.32.13
Version 2.6.0-development+timestamp.2013.09.02.20.41.19
+10 -2
View File
@@ -2457,15 +2457,23 @@ class MENU(DIV):
def serialize_mobile(self, data, select=None, prefix=''):
if not select:
select = SELECT(**self.attributes)
custom_items = []
for item in data:
if len(item) <= 4 or item[4] == True:
# Custom item aren't serialized as mobile
if len(item) >= 3 and (not item[0]) or (isinstance(item[0], DIV) and not (item[2])):
# ex: ('', False,A('title',_href=URL(...),_title="title"))
# ex: (A('title',_href=URL(...),_title="title"), False, None)
custom_items.append(item)
elif len(item) <= 4 or item[4] == True:
select.append(OPTION(CAT(prefix, item[0]),
_value=item[2], _selected=item[1]))
if len(item) > 3 and len(item[3]):
self.serialize_mobile(
item[3], select, prefix=CAT(prefix, item[0], '/'))
select['_onchange'] = 'window.location=this.value'
return select
# avoid to wrap the select if no custom items are present
html = DIV(select, self.serialize(custom_items)) if len( custom_items) else select
return html
def xml(self):
if self['mobile']: