Skip to content

Commit

Permalink
Highlight current page in menus.
Browse files Browse the repository at this point in the history
The current page will have the "current" HTML class applied to its
relevant list item in the auto-generated menus (note that there's no
styling in the default theme to reflect it, but its useful if you're
making your own design).
  • Loading branch information
gma committed Jun 23, 2011
1 parent f217f8f commit 57c0e29
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES
Expand Up @@ -3,6 +3,9 @@
* Strip trailing # characters from Markdown headings at the top of a
page.

* Add an HTML class ("current") to the menu items whose path matches
the current page.

* Bug fix: Don't render the return value of local_stylesheet_link_tag
directly into the page (haml_tag now writes direct to the output
buffer).
Expand Down
3 changes: 2 additions & 1 deletion lib/nesta/navigation.rb
Expand Up @@ -21,7 +21,8 @@ def display_menu_item(item, options = {})
end
end
else
haml_tag :li do
html_class = (request.path == item.abspath) ? "current" : nil
haml_tag :li, :class => html_class do
haml_tag :a, :<, :href => item.abspath do
haml_concat item.heading
end
Expand Down

0 comments on commit 57c0e29

Please sign in to comment.