Thanks Niphlod,
Yes, it's more 'tune my code' is it's perfectly working, and it keeps very
fast.
The problem with the javascript version is that I want to have the
Translated name of the menu not just the link.
My previous version is buggy when you're not logged in. So, I had to adapt :
{{
l = [x[0] for x in response.menu if x[1]==True]
=l[0] if len(l)>0 else T('Welcome')
}}
I was just expecting something like reponse.menu.active but it does not
exists.
Anyway thanks, I'll keep my workaround.
Regards,
Le samedi 19 mai 2012 14:22:23 UTC+2, François Delpierre a écrit :
>
> Hi,
>
> Here is my solution :
> If my response.menu is somthing like :
>
> response.menu = [('Menu1', False), ('Menu2', True), ('Menu3', False)]
>
> I can use this in my view to display the active menu :
> {{=[x[0] for x in response.menu if x[1]==True][0]}}
>
>
> It's working well, but is there no better and more efficient way ?
>
> Thanks,
>