gitlab-org--gitlab-foss/app/assets/javascripts/sidebar.js.coffee

27 lines
761 B
CoffeeScript
Raw Normal View History

collapsed = 'page-sidebar-collapsed'
expanded = 'page-sidebar-expanded'
2015-02-03 16:11:33 -05:00
toggleSidebar = ->
2015-02-03 20:13:06 -05:00
$('.page-with-sidebar').toggleClass("#{collapsed} #{expanded}")
$('header').toggleClass("header-collapsed header-expanded")
$('.toggle-nav-collapse i').toggleClass("fa-angle-right fa-angle-left")
2015-02-03 20:13:06 -05:00
$.cookie("collapsed_nav", $('.page-with-sidebar').hasClass(collapsed), { path: '/' })
2016-02-16 17:04:01 -05:00
setTimeout ( ->
niceScrollBars = $('.nicescroll').niceScroll();
niceScrollBars.updateScrollBar();
), 300
2016-05-09 19:53:25 -04:00
$(document).on("click", '.toggle-nav-collapse, .side-nav-toggle', (e) ->
e.preventDefault()
toggleSidebar()
)
2016-03-10 12:04:45 -05:00
$ ->
size = bp.getBreakpointSize()
if size is "xs" or size is "sm"
if $('.page-with-sidebar').hasClass(expanded)
toggleSidebar()