Just for testing the menu, I have changed the menu of a new application:
if 'auth' in globals():
if not auth.is_logged_in():
response.menu_auth = [
[T('True'), True, "",[]],
[T('False'), False, "",[]],
[T('True'), True, "",[]],
[T('False'), False, "",[]],
]
so I would expect that the "True" menu items have different style than the
"False" menu items... but this is what web2py writes:
<h2>Authentication</h2>
<ul class="web2py-menu web2py-menu-vertical">
<li><a href="#null">True</a></li>
<li><a href="#null">False</a></li>
<li><a href="#null">True</a></li>
<li><a href="#null">False</a></li>
</ul>
is it working as expected ? if yes, is there any way to set a menu item as
activated ?
thanks
On Thu, Aug 13, 2009 at 8:07 AM, mdipierro <[email protected]> wrote:
>
> None of the two. Each menu item has an "active" attribute that can be
> true or false. It is set manually. The default layout does not use it.
> Your own layout may need it so it is there.
>
> On Aug 12, 12:04 pm, "Sebastian E. Ovide" <[email protected]>
> wrote:
> > Is it a bug or a feature not implemented yet ?
> >
> > On Fri, Jul 3, 2009 at 12:08 PM, Álvaro Justen [Turicas] <
> >
> >
> >
> > [email protected]> wrote:
> >
> > > On Fri, Jul 3, 2009 at 06:44, Vidul Petrov<[email protected]>
> 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
> >
>
--
Sebastian E. Ovide
skype: seezov
+353 87 6340149
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---