Skip to content

Instantly share code, notes, and snippets.

@TheRealNeil
Created January 16, 2018 13:23
Show Gist options
  • Save TheRealNeil/01fa01d95ad6c7e12597802a2bcac64a to your computer and use it in GitHub Desktop.
Save TheRealNeil/01fa01d95ad6c7e12597802a2bcac64a to your computer and use it in GitHub Desktop.
DNA Side Navigation
nav#sidebar.navbar.bg-light.navbar-light.border-right-1.full-height
%ul.navbar-nav.mb-auto
-# Repository
%li.nav-item
= link_to("#repositorySubmenu", class: "nav-link", data:{toggle:"collapse"}, aria:{expanded:"#{params[:controller].split('/')[0] == 'repository'}"}) do
%i.fa.fa-database{ aria: { hidden: "true" } }
%span.sidebar-text.hidden-sm-down= t('repository')
%ul#repositorySubmenu{class: "collapse list-unstyled #{'show' if params[:controller].split('/')[0] == 'repository'}"}
%li.nav-item= link_to t('processes'), repository_process_areas_path, class: "nav-link #{active?(params[:controller].split('/')[1], 'process_areas')}"
%li.nav-item= link_to t('scenarios'), repository_scenario_types_path, class: "nav-link #{active?(params[:controller].split('/')[1], 'scenario_types')}"
-# Blueprints
%li.nav-item
= link_to("#blueprintSubmenu", class: "nav-link", data:{toggle:"collapse"}, aria:{expanded:"#{params[:controller].split('/')[0] == 'blueprint'}"}) do
%i.fa.fa-map-o{ aria: { hidden: "true" } }
= t('blueprints')
-# Locations
%ul#blueprintSubmenu{class: "collapse list-unstyled #{'show' if params[:controller].split('/')[0] == 'blueprint'}"}
- Location.all.each do |location|
%li.nav-item
= link_to location.name, "#location#{location.id}Submenu", class: "nav-link", data:{toggle:"collapse"}, aria:{expanded:"false"}
-# Processes & Scenarios
%ul{id: "location#{location.id}Submenu", class: "collapse list-unstyled"}
%li.nav-item= link_to t('processes'), blueprint_location_departments_path(location), class: "nav-link #{active?(params[:controller].split('/')[1], 'process_areas')}"
%li.nav-item= link_to t('scenarios'), blueprint_location_scenario_types_path(location), class: "nav-link #{active?(params[:controller].split('/')[1], 'scenario_types')}"
-# Quality Assurance
%li.nav-item
= link_to(qa_test_plans_path, class: "nav-link #{active?(params[:controller].split('/')[0], 'quality_assurance')}") do
%i.fa.fa-check-square-o{ aria: { hidden: "true" } }
= t('quality_assurance')
-# Defect Management
%li.nav-item
= link_to(defect_management_path, class: "nav-link #{active?(params[:controller].split('/')[0], 'defect_management')}") do
%i.fa.fa-exclamation-triangle{ aria: { hidden: "true" } }
= t('defect_management')
-#.content
-# %button#sidebarCollapse.btn.btn-info.navbar-btn{type:"button"}
-# %i.glyphicon.glyphicon-align-left
-# Toggle Sidebar
:css
#sidebar {
position: fixed;
top: 80px;
left: 0;
width: 200px;
}
:javascript
$(document).ready(function () {
$('#sidebarCollapse').on('click', function () {
$('#sidebar').toggleClass('active');
// $('.collapse.show').toggleClass('show');
// $('a[aria-expanded=true]').attr('aria-expanded', 'false');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment