summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-03-22 14:08:27 +0000
committerPhil Hughes <me@iamphill.com>2016-03-22 14:08:27 +0000
commit21f5524926c3d3ac750ab1bb3781d320cd3e6cca (patch)
tree62d495b758935430b436b1ca2b7ad5b82f86f74f
parent8df6c3b9604ed7b762fd5485275e10f94e698664 (diff)
downloadgitlab-ce-auto-collapse-nav.tar.gz
Auto collapses the navigation when resizingauto-collapse-nav
Closes #14475
-rw-r--r--app/assets/javascripts/application.js.coffee11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee
index 01451830653..3c83450ce18 100644
--- a/app/assets/javascripts/application.js.coffee
+++ b/app/assets/javascripts/application.js.coffee
@@ -218,13 +218,20 @@ $ ->
$this = $(this)
$this.attr 'value', $this.val()
+ $sidebarGutterToggle = $('.js-sidebar-toggle')
+ $navIconToggle = $('.toggle-nav-collapse')
+
$(document)
.off 'breakpoint:change'
.on 'breakpoint:change', (e, breakpoint) ->
if breakpoint is 'sm' or breakpoint is 'xs'
- $gutterIcon = $('.js-sidebar-toggle').find('i')
+ $gutterIcon = $sidebarGutterToggle.find('i')
if $gutterIcon.hasClass('fa-angle-double-right')
- $gutterIcon.closest('a').trigger('click')
+ $sidebarGutterToggle.trigger('click')
+
+ $navIcon = $navIconToggle.find('.fa')
+ if $navIcon.hasClass('fa-angle-left')
+ $navIconToggle.trigger('click')
$(document)
.off 'click', '.js-sidebar-toggle'