Hi Massimo,
Thanks for telling me such undocumented trick to use other app's layout
file. However I still think a built-in layout_jqm.html for scaffold app is
cleaner than cross-app reference. Anyway, see my latest layout_jqm.html
sample in ticket 797 http://code.google.com/p/web2py/issues/detail?id=797
Meanwhile, shall we keep the discussion about how to utilize that
layout_jqm.html (no matter where it locates)? I am using two experimental
callers as below:
cat myapp/views/generic.mobi
{{extend 'layout_jqm.html'}}
{{response.headers['Content-Type'] = 'text/html'}}
# the rest is same as generic.html
cat myapp/controllers/default.py
if request.user_agent().is_mobile or request.user_agent().is_tablet:
response.view = 'generic.mobi'
# the rest is same as the out-of-box welcome/controllers/default.py
These minimal effort makes my app works smooth for both desktop and mobile.
So far so good. Do you think they should go into scaffold too?
Regards,
Ray
On Tuesday, May 15, 2012 2:06:11 AM UTC+8, Massimo Di Pierro wrote:
>
> Please open a ticket about this. I do not think this belongs to the
> welcome app but, if we can use it in admin (instead of the current mobile
> admin also based on jquery mobile) then you will be able to do:
>
> {{extend '../../admin/views/jqm_layout.html'}}
>
> On Monday, 14 May 2012 04:30:23 UTC-5, Ray (a.k.a. Iceberg) wrote:
>>
>> Hi there,
>>
>> 1. I am working at my first mobile website recently. At first I spent
>> (quite) some time to know and download the hard-to-find
>> web2py.plugin.jqmobile.w2p, then I realize the main resource I need is just
>> its views/plugin_jqmobile/layout.html, so it comes to an idea. Why not just
>> pack that tiny layout file inside the default scaffold app as
>> views/jqm_layout.html? (Attached in this post)
>>
>> 2. And then it is so easy to use it. Just {{extend "jqm_layout.html"}}
>> instead of {{extend "layout.html"}} in your view files. I will also suggest
>> one step further. Change the first line of generic.html from:
>>
>> {{extend "layout.html"}}
>>
>> to:
>>
>> {{extend response.layout or "layout.html"}}
>>
>> This way developers can easily switch into two (or even more) layouts on
>> demand by defining a proper response.layout, yet still backward compatible.
>>
>> Will this go into trunk?
>>
>> Regards,
>> Ray
>>
>