Thanks, Alan, great post. And it seems very easy.

On Sunday, June 2, 2013 1:58:24 PM UTC+2, Alan Etkin wrote:
>
> Now, how do I prepare such menu in my controller and then implement it in 
>> the view? What's the best way?
>>
>
> (somewhere in the model)
>
> custom_menu = None
>
> (at the top of the controller)
>
> if not auth.user:
>     custom_menu = MENU(...) # dirty fork menu
> elif auth.has_membership(role="group 1"):
>     custom_menu = MENU(...) # vavarian menu
> elif auth.has_membership(role="group 2"):
>     custom_menu = MENU(...) # mr. Creosote's menu
>
> Then you write into the scaffolding layout.html at the sidebar div:
>
> {{if custom_menu:}}{{=custom_menu}}{{pass}}
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to