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

28 lines
817 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")
$('.sidebar-wrapper').toggleClass("sidebar-collapsed sidebar-expanded")
2015-02-03 20:13:06 -05:00
$('.toggle-nav-collapse i').toggleClass("fa-angle-right fa-angle-left")
$.cookie("collapsed_nav", $('.page-with-sidebar').hasClass(collapsed), { path: '/' })
2016-02-16 17:04:01 -05:00
setTimeout ( ->
niceScrollBars = $('.nicescroll').niceScroll();
niceScrollBars.updateScrollBar();
), 300
$(document).on("click", '.toggle-nav-collapse', (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()