Is it a bug or a feature not implemented yet ?

On Fri, Jul 3, 2009 at 12:08 PM, Álvaro Justen [Turicas] <
alvarojus...@gmail.com> wrote:

>
> On Fri, Jul 3, 2009 at 06:44, Vidul Petrov<vidul.r...@gmail.com> wrote:
> >
> > Hi,
> >
> > Given that I have a menu like:
> >
> > response.menu = [
> >    ['Home', request.function=='index',
> >       URL(request.application,'default','index'), []],
> >    ['New Post', request.function=='create',
> >       URL(request.application,'default','create'), []],
> >    ]
> >
> > the "active" link does not work unless I copy this addition from an
> > older SVN revision in "html.py":
> >
> > diff -a gluon/html.py ~/web2py-read-only/gluon/html.py
> > 1270,1273c1270
> > <               if active:
> > <                 li = LI(A(name, _href=link, _class="active"))
> > <               else:
> > <                 li = LI(A(name, _href=link))
> > ---
> >>                 li = LI(A(name, _href=link))
> >
> > I am wondering why this addition was removed, probably there is a
> > better way to implement the menu?
>
> Sure. There is a bug in this. I think it could fix the problem (not
> tested):
>
>    def serialize(self, data, level=0):
>        if level == 0:
>            ul = UL(**self.attributes)
>        else:
>            ul = UL(_class=self['ul_class'])
>        for item in data:
>            (name, active, link) = item[:3]
>            link_attrs = []
>            if link:
>                link_attrs.append(_href=link)
>            else:
>                link_attrs.append(_href='#null')
>            if active:
>                link_attrs.append(_class='active')
>            li = LI(A(name, *link_attrs))
>            if len(item) > 3 and item[3]:
>                if li['_class']:
>                    li['_class'] += ' ' + self['li_class']
>                else:
>                    li['_class'] = self['li_class']
>                li.append(self.serialize(item[3], level+1))
>            ul.append(li)
>        return ul
>
> --
>  Álvaro Justen
>  Peta5 - Telecomunicações e Software Livre
>  21 3021-6001 / 9898-0141
>  http://www.peta5.com.br/
>
> >
>


-- 

Sebastian E. Ovide

skype: seezov

+353 87 6340149

Sent from Dublin, Ireland

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to