Re: [web2py] Re: Hide menu until after authentication.
I actually totally overlooked that it was placed in layout.html Thanks everybody for the information. I learned a lot again. With regards, Mike Veltman
[web2py] Re: Hide menu until after authentication.
Hi Mike, In the corresponding view you could do: {{if auth.is_logged_in():}} {{=MENU(response.menu)}} {{pass}} Kind regards, Annet.
Re: [web2py] Re: Hide menu until after authentication.
Thanks Annet, Yes I was thinking about it. But that means that I have to remove the menu.py out of the models and place it in each view individually. Thanks for the answer btw. Hi Mike, In the corresponding view you could do: {{if auth.is_logged_in():}} {{=MENU(response.menu)}} {{pass}} Kind regards, Annet. With regards, Mike Veltman
Re: [web2py] Re: Hide menu until after authentication.
On 21/10/2011 09:31, Mike Veltman wrote: Thanks Annet, Yes I was thinking about it. But that means that I have to remove the menu.py out of the models and place it in each view individually. I don't think so... the menu is inside the part that every view import from the main layout... so make the modification directly in your layout.html file and you'll see the result in every view that extend this file my 2ยข Manuele Thanks for the answer btw.
Re: [web2py] Re: Hide menu until after authentication.
On Friday, October 21, 2011 3:31:22 AM UTC-4, Gwayne aka Mike Veltman wrote: Thanks Annet, Yes I was thinking about it. But that means that I have to remove the menu.py out of the models and place it in each view individually. How are you doing it now? Typically, menu.py simply defines response.menu. You then display the menu in a view (typically layout.html) via: {{=MENU(response.menu)}} Making the above line conditional within the view (again, presumably layout.html) shouldn't have any impact on menu.py or where you define response.menu. Anthony
Re: [web2py] Re: Hide menu until after authentication.
# Append one or more additional menu items to reponse.menu using += if auth.is_logged_in(): response.menu+= [ (T('user menu'), False, URL('members','index'), )] # Create an additional response.menu and add a menu to a view using Annets code if auth.is_logged_in(): response.menu_users= [ (T('user menu'), False, URL('members','index'), )] # In either case the above code should probably work for you in your apps menu.py