Skip to content

Commit

Permalink
Improve navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
raghubetina committed Nov 28, 2016
1 parent 72956a9 commit d9c0f61
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ def collapse_search_form
""
end
end

def active_nav_link(path)
request.path.split("/").second == path[1..-1] ? "active" : ""
end
end
15 changes: 10 additions & 5 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<!-- <li><a href="/bookmarks">Bookmarks</a></li> -->
<li><a href="/dishes">Dishes</a></li>
<li><a href="/cuisines">Cuisines</a></li>
<li><a href="/neighborhoods">Neighborhoods</a></li>
<li><a href="/venues">Venues</a></li>
<li class="<%= active_nav_link("/dishes") %>">
<a href="/dishes">
Dishes
</a>
</li>
<li class="<%= active_nav_link("/venues") %>">
<a href="/venues">
Venues
</a>
</li>
<!-- <li><a href="/users">Users</a></li> -->
<!-- <li><a href="/rails/info">Sitemap</a></li> -->
</ul>
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Rails.application.routes.draw do
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
root :to => "venues#index"
root :to => "dishes#index"
# Routes for the Bookmark resource:
# CREATE
get "/bookmarks/new", :controller => "bookmarks", :action => "new"
Expand Down

0 comments on commit d9c0f61

Please sign in to comment.