[web2py] Re: Dynamically change highlighted class for response.menu

2015-12-08 Thread Antonio ds
Hi Add this line before if (path) to ensure highlight on new/edit path = path.split('/',3).join('/'); El jueves, 9 de mayo de 2013, 14:25:00 (UTC-4:30), Niphlod escribió: > > > jQuery(function() { > var path = location.pathname.substring(1); > if ( path ) { > var els = jQuery('

[web2py] Re: Dynamically change highlighted class for response.menu

2014-12-03 Thread Moises Roth
if you need a simple menu you can use this code on "MODELS" > "menu.py" def _(): # shortcuts app = request.application ctr = request.controller # flags pesquisa_h = 'highlighted' if ctr=='pesquisa' else '' relatorios_h = 'highlighted' if ctr=='relatorios' else '' res

[web2py] Re: Dynamically change highlighted class for response.menu

2013-05-09 Thread Omi Chiba
>Niphlod Thank you !! It's perfect now. >Paolo Thank you for the reference that's look easier too especially for someone like me who's not javascript gulu. On Thursday, May 9, 2013 1:55:00 PM UTC-5, Niphlod wrote: > > > jQuery(function() { > var path = location.pathname.substring(1); >

[web2py] Re: Dynamically change highlighted class for response.menu

2013-05-09 Thread Niphlod
jQuery(function() { var path = location.pathname.substring(1); if ( path ) { var els = jQuery('ul.nav a[href$="'+path+'"]').filter( "[rel!=nofollow]"); if (els.length != 0) { els.find('span').addClass('highlighted'); } else { jQuery('#default

[web2py] Re: Dynamically change highlighted class for response.menu

2013-05-09 Thread Paolo Caruccio
for a pyhon solution (not involving javascript) you could check this argument https://groups.google.com/d/topic/web2py/8AHYqV_EKy0/discussion Il giorno martedì 7 maggio 2013 17:56:10 UTC+2, Omi Chiba ha scritto: > > I have a fol

[web2py] Re: Dynamically change highlighted class for response.menu

2013-05-09 Thread Niphlod
I will but you have to wait a few hours for me to get back home :( Il giorno giovedì 9 maggio 2013 15:34:10 UTC+2, Omi Chiba ha scritto: > > Oh, actually it's not working for me > It was working fine with the previous code except default home but now it > doesn't highlight the menu at all. >

[web2py] Re: Dynamically change highlighted class for response.menu

2013-05-09 Thread Omi Chiba
Worked! Thank you~! On Thursday, May 9, 2013 3:38:41 AM UTC-5, Niphlod wrote: > > it's exactly working as expected with the latest snippet. > > Il giorno giovedì 9 maggio 2013 00:15:38 UTC+2, Omi Chiba ha scritto: >> >> Thank you for the additional explanation. >> >> I just want to highlight the h

[web2py] Re: Dynamically change highlighted class for response.menu

2013-05-09 Thread Niphlod
it's exactly working as expected with the latest snippet. Il giorno giovedì 9 maggio 2013 00:15:38 UTC+2, Omi Chiba ha scritto: > > Thank you for the additional explanation. > > I just want to highlight the home by defaut only first time user access > the page. It should be removed when user clic

[web2py] Re: Dynamically change highlighted class for response.menu

2013-05-08 Thread Omi Chiba
Thank you for the additional explanation. I just want to highlight the home by defaut only first time user access the page. It should be removed when user click menu1 or menu2. The home will be highlighted again when user click home. By default. -- Home highlihgted Menu1

[web2py] Re: Dynamically change highlighted class for response.menu

2013-05-08 Thread Niphlod
ps: if you are on the case where you need to have home highlighted by default no matter what, use this javascript snippet (pretty straightforward) Added also a filter() to exclude the registration/login/etc links from being highlighted jQuery(function() { var path = location.pathname.substring

[web2py] Re: Dynamically change highlighted class for response.menu

2013-05-08 Thread Niphlod
uhm. nope. you have to remove the _class="highlighted" alltogether from the Home. Unless you need to highlight "Home" while you're in an hypotetical "menu3". Is that the case ? On Wednesday, May 8, 2013 11:07:52 PM UTC+2, Omi Chiba wrote: > > > > It's almost there!! Your code works perfect but

[web2py] Re: Dynamically change highlighted class for response.menu

2013-05-08 Thread Niphlod
it's working as intended!!! Menu2 is what it becomes when you access the menu2 link. You just need to play with the css now... By default the "home" link is constructed with a SPAN('Home', _class='highlighted') that is inside the A link. if you don't want to play with the css you should build

[web2py] Re: Dynamically change highlighted class for response.menu

2013-05-07 Thread Niphlod
well, that is a snippet that needs to be adjusted to the menu classes in your layout the point more or less is: you have a "menu" that has no children changing the highlight on the clicked one leaves you nowhere, cause once a link has been clicked you jump to the other page, so the sec

[web2py] Re: Dynamically change highlighted class for response.menu

2013-05-07 Thread Omi Chiba
Niphlod , thank you for the reply! Can you provide me actual code workis on new app? I'm not sure where I should put the javascript and what value should I specify for 'all a in the menu'. On Tuesday, May 7, 2013 11:05:27 AM UTC-5, Niphlod wrote: > > javascript .. > > something like > >

[web2py] Re: Dynamically change highlighted class for response.menu

2013-05-07 Thread Niphlod
javascript .. something like $('all a in the menu').click(function(e) { $('all a in the menu').removeClass('highlighted'); $(this).addClass('highlighted'); }) should work . You can even generalize it to highlight the current page url automatically. var path = location.pa