Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,12 @@ def alert_class_for(flash_type)
:notice => 'alert-info'
}[flash_type.to_sym] || flash_type.to_s
end

def nav_link_to(link_text, link_path)
class_name = current_page?(link_path) ? 'active' : nil
content_tag(:li, :class => class_name) do
link_to link_text, link_path
end
end

end
20 changes: 8 additions & 12 deletions app/views/layouts/_header.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,19 @@ nav.navbar.navbar-inverse.navbar-fixed-top role="navigation"
span.icon-bar
span.icon-bar
span.icon-bar
a.navbar-brand href=root_path SpacialDB
= link_to "SpacialDB", root_path, class: 'navbar-brand'
#navbar.collapse.navbar-collapse
ul.nav.navbar-nav
li.active
a href="/" Home
li
a href="#about" About
li
a href="#contact" Contact
li
- if user_signed_in?
a href="/instances" Instances
= nav_link_to "Home", root_path
= nav_link_to "About", "#about"
= nav_link_to "Contact", "#contact"
- if user_signed_in?
= nav_link_to "Instances", instances_path
ul.nav.navbar-nav.navbar-right
li
- if user_signed_in?
.navbar-text.glyphicon.glyphicon-user.no-margin-right
li.navbar-text signed in as #{{current_user.email}}
li = button_to "Sign out", destroy_user_session_path, method: :delete, class: 'btn btn-default navbar-btn'
li.navbar-text signed in as #{{current_user.email}}
li = button_to "Sign out", destroy_user_session_path, method: :delete, class: 'btn btn-default navbar-btn'
- else
= button_to "Sign in", new_session_path(:user), method: :get, class: 'btn btn-default navbar-btn'