diff options
author | Annabel Dunstone Gray <annabel.dunstone@gmail.com> | 2017-02-16 00:56:02 +0300 |
---|---|---|
committer | Annabel Dunstone Gray <annabel.dunstone@gmail.com> | 2017-02-16 02:16:13 +0300 |
commit | 06239e13e580e0a3e6020f2e3b4e8d5d03d7ab92 (patch) | |
tree | ff21efd41de20a65e76abc21ad17166f9af0f9d8 /app/assets/javascripts/right_sidebar.js | |
parent | 20d613639bd90d9f3379d4665a2e3adc5f6b8b17 (diff) |
Move necessary sidebar code to right_sidebar.js; delete sidebar.js
Diffstat (limited to 'app/assets/javascripts/right_sidebar.js')
-rw-r--r-- | app/assets/javascripts/right_sidebar.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/assets/javascripts/right_sidebar.js b/app/assets/javascripts/right_sidebar.js index 76a0f993ea0..82c17956f06 100644 --- a/app/assets/javascripts/right_sidebar.js +++ b/app/assets/javascripts/right_sidebar.js @@ -25,6 +25,8 @@ $('.dropdown').on('hidden.gl.dropdown', this, this.onSidebarDropdownHidden); $('.dropdown').on('loading.gl.dropdown', this.sidebarDropdownLoading); $('.dropdown').on('loaded.gl.dropdown', this.sidebarDropdownLoaded); + $(window).on('resize', () => this.setSidebarHeight()); + $(document).on('scroll', () => this.setSidebarHeight()); $(document).on('click', '.js-sidebar-toggle', function(e, triggered) { var $allGutterToggleIcons, $this, $thisIcon; e.preventDefault(); @@ -191,6 +193,16 @@ } }; + Sidebar.prototype.setSidebarHeight = function() { + const $navHeight = $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight(); + const diff = $navHeight - $('body').scrollTop(); + if (diff > 0) { + $('.js-right-sidebar').outerHeight($(window).height() - diff); + } else { + $('.js-right-sidebar').outerHeight('100%'); + } + }; + Sidebar.prototype.isOpen = function() { return this.sidebar.is('.right-sidebar-expanded'); }; |