Can you please email me the patch? thanks.

On Oct 22, 3:08 pm, Michael Wolfe <michael.joseph.wo...@gmail.com>
wrote:
> Following the sage advice of Jakob Nielsen, I wanted a way to turn off
> links that point to the current page within the menu (see #10 
> here:http://www.useit.com/alertbox/20031110.html).  At the bottom of this
> e-mail, I'm including a proposed patch that would make this easier.
>
> I've added two optional parameters to the MENU helper: no_link_url and
> active_url.
>
> To illustrate how this works, I'll give three examples of what you
> would see for the Index link in the welcome scaffolding app by
> altering the MENU line from layout.html.
>
> 1. Current behavior
> {{=MENU(response.menu,_class='sf-menu')}}
> <li><a href="/welcome/default/index">Index</a></li>
>
> 2. Removing the link for the current page
> {{=MENU(response.menu,_class='sf-menu',no_link_url=request.url)}}
> <li><div>Index</div></li>
>
> 3. Adding the class 'active' to the list item of the link to the current page
> {{=MENU(response.menu,_class='sf-menu',active_url=request.url,
> li_active='active')}}
> <li class="active"><a href="/welcome/default/index">Index</a></li>
>
> And here's the patch.  Please let me know if I've missed something.
>
> diff -r 6608e0e6b4f3 -r badb5215df3f applications/welcome/static/base.css
> --- a/applications/welcome/static/base.css      Fri Oct 15 07:17:35 2010 -0500
> +++ b/applications/welcome/static/base.css      Fri Oct 22 15:11:06 2010 -0400
> @@ -216,9 +216,12 @@
>  .sf-menu {
>         float:  left;
>  }
> -.sf-menu a {
> +.sf-menu a, .sf-menu div {
>         padding: 5px 15px;
>  }
> +.sf-menu div {
> +        color: white;
> +}
>  .sf-menu li {
>         background: #333333;
>  }
> diff -r 6608e0e6b4f3 -r badb5215df3f gluon/html.py
> --- a/gluon/html.py     Fri Oct 15 07:17:35 2010 -0500
> +++ b/gluon/html.py     Fri Oct 22 15:11:06 2010 -0400
> @@ -1699,14 +1699,16 @@
>              ul = UL(_class=self['ul_class'])
>          for item in data:
>              (name, active, link) = item[:3]
> -            if link:
> +            if 'no_link_url' in self.attributes and 
> self['no_link_url']==link:
> +                li = LI(DIV(name))
> +            elif link:
>                  li = LI(A(name, _href=link))
>              else:
>                  li = LI(A(name, _href='#null'))
>              if len(item) > 3 and item[3]:
>                  li['_class'] = self['li_class']
>                  li.append(self.serialize(item[3], level+1))
> -            if active:
> +            if active or 'active_url' in self.attributes and
> self['active_url']==link:
>                  if li['_class']:
>                      li['_class'] = li['_class']+' '+self['li_active']
>                  else:

Reply via email to