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}")
|
2016-06-22 15:30:34 +05:30
|
|
|
$('.navbar-fixed-top').toggleClass("header-collapsed header-expanded")
|
|
|
|
|
|
|
|
if $.cookie('pin_nav') is 'true'
|
|
|
|
$('.navbar-fixed-top').toggleClass('header-pinned-nav')
|
|
|
|
$('.page-with-sidebar').toggleClass('page-sidebar-pinned')
|
2016-04-02 18:10:28 +05:30
|
|
|
|
|
|
|
setTimeout ( ->
|
2016-06-22 15:30:34 +05:30
|
|
|
niceScrollBars = $('.nav-sidebar').niceScroll();
|
2016-04-02 18:10:28 +05:30
|
|
|
niceScrollBars.updateScrollBar();
|
|
|
|
), 300
|
|
|
|
|
2016-06-22 15:30:34 +05:30
|
|
|
$(document)
|
|
|
|
.off 'click', 'body'
|
|
|
|
.on 'click', 'body', (e) ->
|
|
|
|
unless $.cookie('pin_nav') is 'true'
|
|
|
|
$target = $(e.target)
|
|
|
|
$nav = $target.closest('.sidebar-wrapper')
|
|
|
|
pageExpanded = $('.page-with-sidebar').hasClass('page-sidebar-expanded')
|
|
|
|
$toggle = $target.closest('.toggle-nav-collapse, .side-nav-toggle')
|
|
|
|
|
|
|
|
if $nav.length is 0 and pageExpanded and $toggle.length is 0
|
|
|
|
$('.page-with-sidebar')
|
|
|
|
.toggleClass('page-sidebar-collapsed page-sidebar-expanded')
|
|
|
|
|
|
|
|
$('.navbar-fixed-top')
|
|
|
|
.toggleClass('header-collapsed header-expanded')
|
|
|
|
|
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
|
|
|
)
|