Features:
Thanks to Richard <richardbp(at)gmail.com>, for original function that I made improvements
Put in your model/module:
def breadcrumbs(arg_title=None):
"Create breadcrumb links for current request"
# make links pretty by capitalizing and using 'home' instead of 'default'
#pretty = lambda s: s.replace('default', 'Início').replace('_', ' ').capitalize()
menus = [A(T('Home'), _href=URL(r=request, c='default', f='index'))]
if request.controller != 'default':
# add link to current controller
menus.append(A(T(pretty(request.controller)), _href=URL(r=request, c=request.controller, f='index')))
if request.function == 'index':
# are at root of controller
menus[-1] = A(T(pretty(request.controller)), _href=URL(r=request, c=request.controller, f=request.function))
else:
# are at function within controller
menus.append(A(T(pretty(request.function)), _href=URL(r=request, c=request.controller, f=request.function)))
# you can set a title putting using breadcrumbs('My Detail Title')
if request.args and arg_title:
menus.append(A(T(arg_title)), _href=URL(r=request, c=request.controller, f=request.function,args=[request.args]))
else:
#menus.append(A(pretty(request.controller), _href=URL(r=request, c=request.controller, f='index')))
if request.function == 'index':
# are at root of controller
#menus[-1] = pretty(request.controller)
pass
#menus.append(A(pretty(request.controller), _href=URL(r=request, c=request.controller, f=request.function)))
else:
# are at function within controller
menus.append(A(T(pretty(request.function)), _href=URL(r=request, c=request.controller, f=request.function)))
# you can set a title putting using breadcrumbs('My Detail Title')
if request.args and arg_title:
menus.append(A(T(arg_title), _href=URL(r=request, f=request.function,args=[request.args])))
return XML(' > '.join(str(m) for m in menus))
To use, put in your view:
{{=breadcrumbs() }}
or
{{=breadcrumbs('My Title for request.args ') }}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To post to this group, send email to web...@googlegroups.com
To unsubscribe from this group, send email to web2py+un...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---
On Dec 28, 3:45 pm, Alexandre Andrade <alexandrema...@gmail.com>
wrote:
> I improved the function and put it athttp://www.web2pyslices.com/main/slices/take_slice/46
>
> Features:
>
> - links in every breadcrumb
> - can set a breadcrumb to args
> - can localize/personalize the controllers - using T()
> 2009/8/7 Richard <richar...@gmail.com>
> > web2py+un...@googlegroups.com<web2py%2Bunsu...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/web2py?hl=en
> > -~----------~----~----~----~------~----~------~--~---
>
> --
> Atenciosamente
>
> --
> =========================
> Alexandre Andrade
> Hipercenter.com
Hmmmm
You should make a little effort and create a menu plugin too. ;)
They have similarities with a breadcrumb ..
--
sig text
--
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To post to this group, send email to web...@googlegroups.com.For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
To unsubscribe from this group, send email to web2py+un...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To post to this group, send email to web...@googlegroups.com.For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
To unsubscribe from this group, send email to web2py+un...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to web2py+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
On Dec 29, 7:45 am, Alexandre Andrade <alexandrema...@gmail.com>
wrote:
> I improved the function and put it athttp://www.web2pyslices.com/main/slices/take_slice/46
>
> Features:
>
> - links in every breadcrumb
> - can set a breadcrumb to args
> - can localize/personalize the controllers - using T()
> 2009/8/7 Richard <richar...@gmail.com>
> > web2py+un...@googlegroups.com<web2py%2Bunsu...@googlegroups.com>
--
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To post to this group, send email to web...@googlegroups.com.For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
To unsubscribe from this group, send email to web2py+un...@googlegroups.com.