Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

link_to_tagged_current

#395

This patch adds a url helper that allows you to create a link, adding the class "current" when in the current page.

I've found myself using this helper much more than link_to_unless_current. And because almost every site has some sort of tabbed navigation, I think it makes sense to push it to rails.

== Examples

Let's say you have a navigation menu...

<ul id="navbar">
  <li><%= link_to_tagged_current("Home", { :action => "index" }) %></li>
  <li><%= link_to_tagged_current("About Us", { :action => "about" }) %></li>
</ul>

If in the "about" action, it will render...

<ul id="navbar">
  <li><a href="/controller/index">Home</a></li>
  <li><a href="/controller/about" class="current">About Us</a></li>
</ul>

...but if in the "index" action, it will render:

<ul id="navbar">
  <li><a href="/controller/index" class="current">Home</a></li>
  <li><a href="/controller/about">About Us</a></li>
</ul>

Reported by Ary Djmal · June 11th, 2008 @ 11:45 PM

State: invalid
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Pratik
    Pratik
    • State changed from new to invalid

    I think this should stay plugin for now. You can also try to email core mailing list to see what other people think.

    Thanks.

    June 12th, 2008 @ 10:12 AM