Skip to content

Instantly share code, notes, and snippets.

@TheRealNeil
Created January 16, 2018 13:51
Show Gist options
  • Save TheRealNeil/242b309a5f334fea9c81ba354ecc7a04 to your computer and use it in GitHub Desktop.
Save TheRealNeil/242b309a5f334fea9c81ba354ecc7a04 to your computer and use it in GitHub Desktop.
DNA - Navigation Bar
%nav.navbar.sticky-top.navbar-expand.navbar-light.bg-light.border-bottom-1
.navbar-brand
= link_to root_path do
= image_tag 'dna-logo-col.svg', alt:"dna"
- if user_signed_in?
%span.navbar-text.py-0
= yield :page_heading
%button.navbar-toggler{type:"button", data:{toggle:"collapse", target:"#navbarTogglerDemo01"}, aria:{controls:"navbarTogglerDemo01", expanded:"false", label:"Toggle navigation"}}
%span.navbar-toggler-icon
.collapse.navbar-collapse#navbarTogglerDemo01
.navbar-nav.ml-auto
.nav-item.collapse-search
= form_tag search_results_path, method: :get, id: 'search-form', class: 'form-inline' do
#search-container.input-group
= text_field_tag :term, @search_term, id: "search_term_input", class: "form-control", placeholder: "Search for ..."
%span.input-group-btn
%button#search_btn.btn.btn-outline-secondary{type:"submit"}
%i.fa.fa-search{aria:{hidden:"true"}}
.nav-item.dropdown
= link_to '#', html_options = {id:"navbarDropdownMenuLink", class:"nav-link dropdown-toggle",aria:{expanded:"false", haspopup:"true"}, data:{toggle:"dropdown"}} do
%i.fa.fa-user
= current_user.email
.dropdown-menu{aria:{labelledby:'navbarDropdownMenuLink'}}
= link_to( "Change password", edit_user_registration_path, class:'dropdown-item')
= link_to( t('logout'), destroy_user_session_path, :method => :delete, class:'dropdown-item')
.nav-item
= link_to configuration_path, class: 'nav-link' do
%i.fa.fa-cogs
.nav-item.dropdown
= link_to(url_for(locale: "en"), html_options = { class: 'nav-link', role:'button', 'data-toggle':"dropdown" }) do
%span.flag-icon.flag-icon-gb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment