+1 https://groups.google.com/d/msg/web2py-developers/FMCF0HTs64A/CJ-PNCaIsuwJ
2012. augusztus 21., kedd 15:58:27 UTC+2 időpontban mweissen a következőt írta: > > I have played with some menu details and these are my results > > First try: > > response.menu = [ > (T('Home'), False, URL('default','index'), [ > (T('Dummy1'), False, URL('default','index'), [],), > (T('Dummy2'), False, None, [],), > (T('Desktop'), False, URL('default','index'), [], > not (request.user_agent().is_mobile or > request.user_agent().is_mobile)), > (T('Mobile'), False, URL('default','index'), [], > request.user_agent().is_mobile), > (T('Tablet'), False, URL('default','index'), [], > request.user_agent().is_tablet), > ]) > ] > > > *Desktop:* > I have expected and I got: Home | Dummy1 | Dummy2 | Desktop (#1) > > *Mobile phone:* > I have expected: > Home | Dummy1 | Dummy2 | Mobile > > I got: > Home | Dummy1 | Mobile (#2) > > *Tablet:* > I have expected: > Home | Dummy1 | Dummy2 | Tablet > > I got: > Home | Dummy1 | Mobile | Tablet (#2, #3) > > Now a second try: > > response.menu = [ > (T('Home'), False, None, [ > (T('Dummy1'), False, URL('default','index'), [],), > (T('Dummy2'), False, None, [],), > (T('Desktop'), False, URL('default','index'), [], > not (request.user_agent().is_mobile or > request.user_agent().is_mobile)), > (T('Mobile'), False, URL('default','index'), [], > request.user_agent().is_mobile), > (T('Tablet'), False, URL('default','index'), [], > request.user_agent().is_tablet), > ]) > ] > > > *Desktop:* > I have expected and I got: Home | Dummy1 | Dummy2 | Desktop (#1) > > *Mobile phone:* > I have expected: > Home | Dummy1 | Dummy2 | Mobile > > I got: > <empty menu> (#2, #4) > > *Tablet:* > I have expected: > Home | Dummy1 | Dummy2 | Tablet > > I got: > <empty menu> (#2, #4) > > Comments: > > #1: Everything works as expected, but only on a desktop pc > #2: Menu items without a link are not displayed on a mobile device > #3: Interesting: a tablet is a "tablet" *and *a "mobile phone" > #4: The empty menu is very confusing. It took some hours to find it out, > because my "real" menu is more complicated. > > Maybe #2, #3 and #4 are *features *and not *bugs*, but I think, these > things should be documented or changed. > My proposal: menu items should not become invisible depending on the > device. If somebody wants this behavior he could use the fifth component. > > Maybe is_tablet should be True only for tablets and not for mobile phones > too. But in this case there should be not only a mobile.html view but > also a tablet.html. And this would make things more complicated. > > Regards, Martin > > > > --