[web2py] Re: Menus and Selected Tab

2014-10-28 Thread Leonel Câmara
A fix for what? It works perfectly fine in my apps. 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: Menus and Selected Tab

2014-10-26 Thread LoveWeb2py
I would be interested in having this work as well. Was there ever a fix for 
this?

On Sunday, February 16, 2014 12:26:58 PM UTC-5, horridohobbyist wrote:

 In the latest version of web2py, this solution no longer works. There's no 
 web2py-menu-active class. Is it now standard policy for web2py apps not 
 to have menu selections highlighted?

 Thanks.

 On Monday, 17 October 2011 15:00:38 UTC-4, Paolo Caruccio wrote:

 If you're using respone.menu to build your menu and in line with 
 http://www.web2py.com/book/default/search?search=response.menu
 you could replace the second item (the boolean value)in the tuple with 
 the check (request.function=='index') where index is your active page.
 In this way web2py automatically add to li tag (your menu tab) the 
 class=web2py-menu-active. So in .css file you can customize it.

 For example (I'm using default w2p application welcome):

 ### in menu.py (welcome app models folder) ###

 response.menu = [
 (T('Home'), False, URL('default','index'), [])
 ]

 becomes

 response.menu = [
 (T('Home'), (request.function=='index'), URL('default','index'), [])
 ]

 ### in layout.html (welcome app views folder ###

 change this

 {{=MENU(response.menu,_class='sf-menu')}}

 to 

 {{=MENU(response.menu,_class='sf-menu',li_active=tab_highlighted)}}

 li_active allows to change default class web2py-menu-active to your 
 preference. In the above example tab_highlighted.

 ### in base.css (welcome app static/css subfolder) 

 append the css rule

 .web2py-menu-active a, .tab_highlighted a{color:red}

 Ciao.

 Paolo



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


[web2py] Re: Menus and Selected Tab

2014-02-16 Thread horridohobbyist
In the latest version of web2py, this solution no longer works. There's no 
web2py-menu-active class. Is it now standard policy for web2py apps not 
to have menu selections highlighted?

Thanks.

On Monday, 17 October 2011 15:00:38 UTC-4, Paolo Caruccio wrote:

 If you're using respone.menu to build your menu and in line with 
 http://www.web2py.com/book/default/search?search=response.menu
 you could replace the second item (the boolean value)in the tuple with the 
 check (request.function=='index') where index is your active page.
 In this way web2py automatically add to li tag (your menu tab) the 
 class=web2py-menu-active. So in .css file you can customize it.

 For example (I'm using default w2p application welcome):

 ### in menu.py (welcome app models folder) ###

 response.menu = [
 (T('Home'), False, URL('default','index'), [])
 ]

 becomes

 response.menu = [
 (T('Home'), (request.function=='index'), URL('default','index'), [])
 ]

 ### in layout.html (welcome app views folder ###

 change this

 {{=MENU(response.menu,_class='sf-menu')}}

 to 

 {{=MENU(response.menu,_class='sf-menu',li_active=tab_highlighted)}}

 li_active allows to change default class web2py-menu-active to your 
 preference. In the above example tab_highlighted.

 ### in base.css (welcome app static/css subfolder) 

 append the css rule

 .web2py-menu-active a, .tab_highlighted a{color:red}

 Ciao.

 Paolo


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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.


[web2py] Re: Menus and Selected Tab

2011-10-18 Thread horridohobbyist
Sorry, I tried it, but it didn't work.

Richard

On Oct 17, 3:00 pm, Paolo Caruccio paolo.carucci...@gmail.com wrote:
 If you're using respone.menu to build your menu and in line 
 withhttp://www.web2py.com/book/default/search?search=response.menu
 you could replace the second item (the boolean value)in the tuple with the
 check (request.function=='index') where index is your active page.
 In this way web2py automatically add to li tag (your menu tab) the
 class=web2py-menu-active. So in .css file you can customize it.

 For example (I'm using default w2p application welcome):

 ### in menu.py (welcome app models folder) ###

 response.menu = [
     (T('Home'), False, URL('default','index'), [])
     ]

 becomes

 response.menu = [
     (T('Home'), (request.function=='index'), URL('default','index'), [])
     ]

 ### in layout.html (welcome app views folder ###

 change this

 {{=MENU(response.menu,_class='sf-menu')}}

 to

 {{=MENU(response.menu,_class='sf-menu',li_active=tab_highlighted)}}

 li_active allows to change default class web2py-menu-active to your
 preference. In the above example tab_highlighted.

 ### in base.css (welcome app static/css subfolder)

 append the css rule

 .web2py-menu-active a, .tab_highlighted a{color:red}

 Ciao.

 Paolo


[web2py] Re: Menus and Selected Tab

2011-10-18 Thread horridohobbyist
This is all very messy. I think I'll just leave well enough alone.
Pity, though.

I'm quite surprised at how poorly thought-out the Superfish menu
system is.

Richard

On Oct 17, 3:01 pm, ron_m ron.mco...@gmail.com wrote:
 Oops sorry forgot a detail, I did this a while back

 I have a simple mapping of top level menu item to controller name so this
 works for me because of how it is organized. This allows me to remove
 functions from the application depending on where it is installed. Some
 clients don't use every possible top level menu item.

 So to figure out the active path in model/menu.py all i need is

     active_path = request.controller

 Then the menu items are constructed with a True False in the second item of
 the tuple using logic like this on each item.

             response.menu+=[
                 (MAP, True if active_path == 'map' else False, URL(c='map',
 f='index'), [])        
             ]

 MAP = T('Map') to allow translation to fill out a missing part of the above
 code fragment.

 I realize this has some limitations such as forcing a top level menu item
 and a controller name to be connected but I was willing to accept that..


[web2py] Re: Menus and Selected Tab

2011-10-17 Thread ron_m
If you are using superfish menus in views/layout.html hee is what I did.

I changed
  script type=text/javascript
jQuery(document).ready(function(){
jQuery('ul.sf-menu').superfish();});
  /script

to be
  script type=text/javascript
jQuery(document).ready(function(){
jQuery('ul.sf-menu').superfish({pathClass: 
'web2py-menu-active'});});
  /script

Really only a parameter addition in third line, extra lines are there to add 
context.

Then look for the superfish.css file for the selector
.sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active {
if you want a different color than the default.

Ron


[web2py] Re: Menus and Selected Tab

2011-10-17 Thread horridohobbyist
I tried that (though I didn't bother to change the default color).
Doesn't seem to work - the active menu still isn't highlighted.

Regards,
Richard

On Oct 17, 1:09 pm, ron_m ron.mco...@gmail.com wrote:
 If you are using superfish menus in views/layout.html hee is what I did.

 I changed
       script type=text/javascript
         jQuery(document).ready(function(){
         jQuery('ul.sf-menu').superfish();});
       /script

 to be
       script type=text/javascript
         jQuery(document).ready(function(){
         jQuery('ul.sf-menu').superfish({pathClass:
 'web2py-menu-active'});});
       /script

 Really only a parameter addition in third line, extra lines are there to add
 context.

 Then look for the superfish.css file for the selector
 .sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active {
 if you want a different color than the default.

 Ron


[web2py] Re: Menus and Selected Tab

2011-10-17 Thread Paolo Caruccio
If you're using respone.menu to build your menu and in line with 
http://www.web2py.com/book/default/search?search=response.menu
you could replace the second item (the boolean value)in the tuple with the 
check (request.function=='index') where index is your active page.
In this way web2py automatically add to li tag (your menu tab) the 
class=web2py-menu-active. So in .css file you can customize it.

For example (I'm using default w2p application welcome):

### in menu.py (welcome app models folder) ###

response.menu = [
(T('Home'), False, URL('default','index'), [])
]

becomes

response.menu = [
(T('Home'), (request.function=='index'), URL('default','index'), [])
]

### in layout.html (welcome app views folder ###

change this

{{=MENU(response.menu,_class='sf-menu')}}

to 

{{=MENU(response.menu,_class='sf-menu',li_active=tab_highlighted)}}

li_active allows to change default class web2py-menu-active to your 
preference. In the above example tab_highlighted.

### in base.css (welcome app static/css subfolder) 

append the css rule

.web2py-menu-active a, .tab_highlighted a{color:red}

Ciao.

Paolo


[web2py] Re: Menus and Selected Tab

2011-10-17 Thread ron_m
Oops sorry forgot a detail, I did this a while back

I have a simple mapping of top level menu item to controller name so this 
works for me because of how it is organized. This allows me to remove 
functions from the application depending on where it is installed. Some 
clients don't use every possible top level menu item.

So to figure out the active path in model/menu.py all i need is

active_path = request.controller

Then the menu items are constructed with a True False in the second item of 
the tuple using logic like this on each item.

response.menu+=[
(MAP, True if active_path == 'map' else False, URL(c='map', 
f='index'), [])
]

MAP = T('Map') to allow translation to fill out a missing part of the above 
code fragment.


I realize this has some limitations such as forcing a top level menu item 
and a controller name to be connected but I was willing to accept that..