Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAdam Pahlevi <adam.pahlevi@gmail.com>2017-01-31 01:42:02 +0300
committerAdam Pahlevi <adam.pahlevi@gmail.com>2017-02-08 00:42:03 +0300
commite0a900630c7c61d8c3738440dfb87bb24ebf99d7 (patch)
tree244c72120dd8e3681a865c2873136744537d6aee /app
parentf54917f118f78e08f813d451c152c2571d159829 (diff)
dismiss sidebar on repo buttons click
make the selector more inclusive spec for dashboard’s sidebar visibility fix linting errors for project dashboard page remove unused var: shouldBeCollapsed use project with repo, so download button became available use es6 style for testing project dashboard un-aliased global reference at sidebar.js.es6 fix spec from linting errors code improvement add singleton to `this` assign `singleton` to class add space in between remove `no-underscore-dangle` add complete changelog sidebar internal state test remove on page change, not exist in master. rebase. only nicescroll if the element is there new require style reference to sidebar content outside of timeout
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/sidebar.js.es623
1 files changed, 12 insertions, 11 deletions
diff --git a/app/assets/javascripts/sidebar.js.es6 b/app/assets/javascripts/sidebar.js.es6
index ee172f2fa6f..cbb2ae9f1bd 100644
--- a/app/assets/javascripts/sidebar.js.es6
+++ b/app/assets/javascripts/sidebar.js.es6
@@ -1,9 +1,7 @@
/* eslint-disable arrow-parens, class-methods-use-this, no-param-reassign */
/* global Cookies */
-((global) => {
- let singleton;
-
+(() => {
const pinnedStateCookie = 'pin_nav';
const sidebarBreakpoint = 1024;
@@ -23,11 +21,12 @@
class Sidebar {
constructor() {
- if (!singleton) {
- singleton = this;
- singleton.init();
+ if (!Sidebar.singleton) {
+ Sidebar.singleton = this;
+ Sidebar.singleton.init();
}
- return singleton;
+
+ return Sidebar.singleton;
}
init() {
@@ -39,7 +38,7 @@
$(document)
.on('click', sidebarToggleSelector, () => this.toggleSidebar())
.on('click', pinnedToggleSelector, () => this.togglePinnedState())
- .on('click', 'html, body', (e) => this.handleClickEvent(e))
+ .on('click', 'html, body, a, button', (e) => this.handleClickEvent(e))
.on('DOMContentLoaded', () => this.renderState())
.on('todo:toggle', (e, count) => this.updateTodoCount(count));
this.renderState();
@@ -88,10 +87,12 @@
$pinnedToggle.attr('title', tooltipText).tooltip('fixTitle').tooltip(tooltipState);
if (this.isExpanded) {
- setTimeout(() => $(sidebarContentSelector).niceScroll().updateScrollBar(), 200);
+ const sidebarContent = $(sidebarContentSelector);
+ setTimeout(() => { sidebarContent.niceScroll().updateScrollBar(); }, 200);
}
}
}
- global.Sidebar = Sidebar;
-})(window.gl || (window.gl = {}));
+ window.gl = window.gl || {};
+ gl.Sidebar = Sidebar;
+})();