Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #19 from PragTob/LinkFixing

Fixing the menu highliting
  • Loading branch information...
commit 93ca92d33018299093419418a3b6e6886ac65228 2 parents dd689cc + 41d3d3b
@jrgifford jrgifford authored
Showing with 8 additions and 7 deletions.
  1. +2 −1  template.rb
  2. +6 −6 views/layout.html.haml
View
3  template.rb
@@ -6,7 +6,8 @@ def initialize(view)
end
def render(locals={})
- Haml::Engine.new(File.read("views/layout.html.haml")).render do
+ locals.merge! page: @view
+ Haml::Engine.new(File.read("views/layout.html.haml")).render(Object.new, locals) do
Haml::Engine.new(File.read("views/#{@view}.html.haml")).render(Object.new, locals)
end
end
View
12 views/layout.html.haml
@@ -38,17 +38,17 @@
%a.brand{:href => "/"} Shoes
.nav-collapse
%ul.nav
- %li.active
+ %li{ :class => ('active' if page == :index) }
%a{:href => "/"} Home
- %li
+ %li{ :class => ('active' if page == :downloads) }
%a{:href => "/downloads"} Downloads
- %li
+ %li{ :class => ('active' if page == :tutorials) }
%a{:href => "/tutorials"} Tutorials
- %li
+ %li{ :class => ('active' if page == :blog) }
%a{:href => "/blog"} Blog
- %li
+ %li{ :class => ('active' if page == :contribute) }
%a{:href => "/contribute"} Contribute
- %li
+ %li{ :class => ('active' if page == :about) }
%a{:href => "/about"} About
/ /.nav-collapse
.container
Please sign in to comment.
Something went wrong with that request. Please try again.