Commit 7203826b authored by Annabel Dunstone Gray's avatar Annabel Dunstone Gray

Cache js selectors; fix css

parent 7308e2b9
...@@ -21,13 +21,16 @@ ...@@ -21,13 +21,16 @@
}; };
Sidebar.prototype.addEventListeners = function() { Sidebar.prototype.addEventListeners = function() {
const $document = $(document);
const throttledSetSidebarHeight = _.throttle(this.setSidebarHeight, 10);
this.sidebar.on('click', '.sidebar-collapsed-icon', this, this.sidebarCollapseClicked); this.sidebar.on('click', '.sidebar-collapsed-icon', this, this.sidebarCollapseClicked);
$('.dropdown').on('hidden.gl.dropdown', this, this.onSidebarDropdownHidden); $('.dropdown').on('hidden.gl.dropdown', this, this.onSidebarDropdownHidden);
$('.dropdown').on('loading.gl.dropdown', this.sidebarDropdownLoading); $('.dropdown').on('loading.gl.dropdown', this.sidebarDropdownLoading);
$('.dropdown').on('loaded.gl.dropdown', this.sidebarDropdownLoaded); $('.dropdown').on('loaded.gl.dropdown', this.sidebarDropdownLoaded);
$(window).on('resize', () => this.setSidebarHeight()); $(window).on('resize', () => throttledSetSidebarHeight());
$(document).on('scroll', () => this.setSidebarHeight()); $document.on('scroll', () => throttledSetSidebarHeight());
$(document).on('click', '.js-sidebar-toggle', function(e, triggered) { $document.on('click', '.js-sidebar-toggle', function(e, triggered) {
var $allGutterToggleIcons, $this, $thisIcon; var $allGutterToggleIcons, $this, $thisIcon;
e.preventDefault(); e.preventDefault();
$this = $(this); $this = $(this);
...@@ -195,11 +198,12 @@ ...@@ -195,11 +198,12 @@
Sidebar.prototype.setSidebarHeight = function() { Sidebar.prototype.setSidebarHeight = function() {
const $navHeight = $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight(); const $navHeight = $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight();
const $rightSidebar = $('.js-right-sidebar');
const diff = $navHeight - $('body').scrollTop(); const diff = $navHeight - $('body').scrollTop();
if (diff > 0) { if (diff > 0) {
$('.js-right-sidebar').outerHeight($(window).height() - diff); $rightSidebar.outerHeight($(window).height() - diff);
} else { } else {
$('.js-right-sidebar').outerHeight('100%'); $rightSidebar.outerHeight('100%');
} }
}; };
......
...@@ -110,15 +110,15 @@ header { ...@@ -110,15 +110,15 @@ header {
font-size: 11px; font-size: 11px;
} }
li.active { li {
a { .active a {
font-weight: bold; font-weight: bold;
} }
}
li:hover { &:hover {
.badge { .badge {
background-color: $white-light; background-color: $white-light;
}
} }
} }
} }
......
.page-with-sidebar{ class: "#{page_gutter_class}" } .page-with-sidebar{ class: page_gutter_class }
- if defined?(nav) && nav - if defined?(nav) && nav
.layout-nav .layout-nav
.container-fluid .container-fluid
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment