About menu and current page

59 views
Skip to first unread message

Константин Комков

unread,
Mar 4, 2020, 6:13:26 AM3/4/20
to web2py-users
Hello, are somebody know how create link in menu empty if current page like link in menu, but not empty if page is not like in link.
I do like that:
response.menu.insert(0, (T('Editor'), False, '#', [
   
(T('Edit timetable'), False, '#' if (request.controller == 'default' and request.function == 'selectTimetable') else URL('default', 'selectTimetable')),
]))
If there is more elegant way share it please.

Alex Beskopilny

unread,
Mar 4, 2020, 11:00:12 AM3/4/20
to web2py-users
items_sub_menu= []
menu_item = [ (chr( 0x0001f534 ), False, URL('default', 'index'), items_sub_menu) ]

save_orig_menu= response.menu
response.menu = menu_item
response.menu += save_orig_menu
items_sub_menu.append( (T('home'), False, URL(_app, 'default', 'index') ),)
items_sub_menu.append( (T('appadmin'), False, URL(_app, 'appadmin', 'index') ),)


items_sub_menu.append( (T('ctrlnm1'), False, URL('ctrlnm1','index') ), )

items_sub_menu.append( (T('ctrlnm2'), False, URL('ctrlnm2','index') ), )


среда, 4 марта 2020 г., 14:13:26 UTC+3 пользователь Константин Комков написал:

Константин Комков

unread,
Mar 9, 2020, 3:31:30 AM3/9/20
to web2py-users
Alex Beskopilny, I know how to make sub menu. There is example in welcom web2py app. I asked about link.
Is there more elegant way?
Reply all
Reply to author
Forward
0 new messages