From ae65272bbf6f66162730f373bfa0236c67276c11 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Lopez Date: Mon, 14 Nov 2016 12:56:52 -0600 Subject: Fixed Issuable sidebar so it remains closed on mobile/smaller screen devices Added test to replicate the bug, also added a couple of helpers that can be reused on the testing suite to resize the browser window, these helpers are located on the spec/support/mobile_helpers.rb --- app/assets/javascripts/application.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'app/assets/javascripts/application.js') diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index f0615481ed2..1333bea5644 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -84,7 +84,6 @@ var $sidebarGutterToggle = $('.js-sidebar-toggle'); var $flash = $('.flash-container'); var bootstrapBreakpoint = bp.getBreakpointSize(); - var checkInitialSidebarSize; var fitSidebarForSize; // Set the default path for all cookies to GitLab's root directory @@ -246,19 +245,19 @@ return $document.trigger('breakpoint:change', [bootstrapBreakpoint]); } }; - checkInitialSidebarSize = function () { - bootstrapBreakpoint = bp.getBreakpointSize(); - if (bootstrapBreakpoint === 'xs' || 'sm') { - return $document.trigger('breakpoint:change', [bootstrapBreakpoint]); - } - }; $window.off('resize.app').on('resize.app', function () { return fitSidebarForSize(); }); + window.addEventListener('beforeunload', function() { + // collapsed_gutter cookie hides the sidebar + var bpBreakpoint = bp.getBreakpointSize(); + if (bpBreakpoint === 'xs' || bpBreakpoint === 'sm') { + Cookies.set('collapsed_gutter', true); + } + }); + gl.awardsHandler = new AwardsHandler(); - checkInitialSidebarSize(); new Aside(); - // bind sidebar events new gl.Sidebar(); }); -- cgit v1.2.1 From ffc5ec7d7723d429661d9f3e27a8be98a7976359 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Wed, 25 Jan 2017 12:25:43 -0600 Subject: Moved the turbolinks listener from application.js to the corresponding issuable sidebar file --- app/assets/javascripts/application.js | 8 -------- 1 file changed, 8 deletions(-) (limited to 'app/assets/javascripts/application.js') diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 1333bea5644..4849aab50f4 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -248,14 +248,6 @@ $window.off('resize.app').on('resize.app', function () { return fitSidebarForSize(); }); - window.addEventListener('beforeunload', function() { - // collapsed_gutter cookie hides the sidebar - var bpBreakpoint = bp.getBreakpointSize(); - if (bpBreakpoint === 'xs' || bpBreakpoint === 'sm') { - Cookies.set('collapsed_gutter', true); - } - }); - gl.awardsHandler = new AwardsHandler(); new Aside(); // bind sidebar events -- cgit v1.2.1