debian-mirror-gitlab/app/assets/javascripts/sidebar.js.coffee

27 lines
761 B
CoffeeScript
Raw Normal View History

2016-06-02 11:05:42 +05:30
collapsed = 'page-sidebar-collapsed'
expanded = 'page-sidebar-expanded'
2015-04-26 12:48:37 +05:30
2016-06-02 11:05:42 +05:30
toggleSidebar = ->
2015-04-26 12:48:37 +05:30
$('.page-with-sidebar').toggleClass("#{collapsed} #{expanded}")
2015-09-11 14:41:01 +05:30
$('header').toggleClass("header-collapsed header-expanded")
2015-04-26 12:48:37 +05:30
$('.toggle-nav-collapse i').toggleClass("fa-angle-right fa-angle-left")
$.cookie("collapsed_nav", $('.page-with-sidebar').hasClass(collapsed), { path: '/' })
2016-04-02 18:10:28 +05:30
setTimeout ( ->
niceScrollBars = $('.nicescroll').niceScroll();
niceScrollBars.updateScrollBar();
), 300
2016-06-02 11:05:42 +05:30
$(document).on("click", '.toggle-nav-collapse, .side-nav-toggle', (e) ->
e.preventDefault()
toggleSidebar()
2015-04-26 12:48:37 +05:30
)
2016-06-02 11:05:42 +05:30
$ ->
size = bp.getBreakpointSize()
if size is "xs" or size is "sm"
if $('.page-with-sidebar').hasClass(expanded)
toggleSidebar()