Commit a11e798a authored by Annabel Dunstone Gray's avatar Annabel Dunstone Gray

Keep sidebars absolute until fixed at top; remove unneeded JS

parent eefbc2bf
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
Build.prototype.initSidebar = function() { Build.prototype.initSidebar = function() {
this.$sidebar = $('.js-build-sidebar'); this.$sidebar = $('.js-build-sidebar');
<<<<<<< 36beffc12461d2e479ad8b000b7ba5b6ea40cd33
this.sidebarTranslationLimits = { this.sidebarTranslationLimits = {
<<<<<<< 3ee255139ab555ec49a177d3b2eed65580f36c4f <<<<<<< 3ee255139ab555ec49a177d3b2eed65580f36c4f
min: $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight() min: $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight()
...@@ -80,9 +81,10 @@ ...@@ -80,9 +81,10 @@
this.$sidebar.css({ this.$sidebar.css({
top: this.sidebarTranslationLimits.max top: this.sidebarTranslationLimits.max
}); });
=======
>>>>>>> Keep sidebars absolute until fixed at top; remove unneeded JS
this.$sidebar.niceScroll(); this.$sidebar.niceScroll();
this.$document.off('click', '.js-sidebar-build-toggle').on('click', '.js-sidebar-build-toggle', this.toggleSidebar); this.$document.off('click', '.js-sidebar-build-toggle').on('click', '.js-sidebar-build-toggle', this.toggleSidebar);
this.$document.off('scroll.translateSidebar').on('scroll.translateSidebar', this.translateSidebar.bind(this));
}; };
Build.prototype.location = function() { Build.prototype.location = function() {
...@@ -237,14 +239,6 @@ ...@@ -237,14 +239,6 @@
return bootstrapBreakpoint === 'xs' || bootstrapBreakpoint === 'sm'; return bootstrapBreakpoint === 'xs' || bootstrapBreakpoint === 'sm';
}; };
Build.prototype.translateSidebar = function(e) {
var newPosition = this.sidebarTranslationLimits.max - (document.body.scrollTop || document.documentElement.scrollTop);
if (newPosition < this.sidebarTranslationLimits.min) newPosition = this.sidebarTranslationLimits.min;
this.$sidebar.css({
top: newPosition
});
};
Build.prototype.toggleSidebar = function(shouldHide) { Build.prototype.toggleSidebar = function(shouldHide) {
var shouldShow = typeof shouldHide === 'boolean' ? !shouldHide : undefined; var shouldShow = typeof shouldHide === 'boolean' ? !shouldHide : undefined;
this.$buildScroll.toggleClass('sidebar-expanded', shouldShow) this.$buildScroll.toggleClass('sidebar-expanded', shouldShow)
......
...@@ -337,7 +337,7 @@ require('./flash'); ...@@ -337,7 +337,7 @@ require('./flash');
.affix({ .affix({
offset: { offset: {
top: () => ( top: () => (
$diffTabs.offset().top - $tabs.height() - $fixedNav.height() - $layoutNav.height() $diffTabs.offset().top - $tabs.height()
), ),
}, },
}) })
......
...@@ -416,14 +416,20 @@ ...@@ -416,14 +416,20 @@
} }
.page-with-layout-nav { .page-with-layout-nav {
.right-sidebar { .right-sidebar {
top: ($header-height * 2) + 2; top: ($header-height * 2) + 2;
} }
.build-sidebar {
top: ($header-height * 3) + 3;
&.affix {
top: 0;
}
}
} }
.activities { .activities {
.nav-block { .nav-block {
border-bottom: 1px solid $border-color; border-bottom: 1px solid $border-color;
......
...@@ -256,4 +256,9 @@ header.header-sidebar-pinned { ...@@ -256,4 +256,9 @@ header.header-sidebar-pinned {
.right-sidebar { .right-sidebar {
border-left: 1px solid $border-color; border-left: 1px solid $border-color;
&.affix {
position: fixed;
top: 0;
}
} }
...@@ -189,7 +189,8 @@ ...@@ -189,7 +189,8 @@
} }
.right-sidebar { .right-sidebar {
position: fixed; position: absolute;
height: 100%;
top: $header-height; top: $header-height;
bottom: 0; bottom: 0;
right: 0; right: 0;
......
...@@ -479,7 +479,7 @@ ...@@ -479,7 +479,7 @@
background-color: $white-light; background-color: $white-light;
&.affix { &.affix {
top: 100px; top: 0;
left: 0; left: 0;
z-index: 10; z-index: 10;
transition: right .15s; transition: right .15s;
......
...@@ -171,8 +171,6 @@ ...@@ -171,8 +171,6 @@
.tree-controls { .tree-controls {
float: right; float: right;
margin-top: 11px; margin-top: 11px;
position: relative;
z-index: 2;
.project-action-button { .project-action-button {
margin-left: $btn-side-margin; margin-left: $btn-side-margin;
......
- builds = @build.pipeline.builds.to_a - builds = @build.pipeline.builds.to_a
%aside.right-sidebar.right-sidebar-expanded.build-sidebar.js-build-sidebar %aside.right-sidebar.right-sidebar-expanded.build-sidebar.js-build-sidebar{ data: { "offset-top" => "151", "spy" => "affix" } }
.block.build-sidebar-header.visible-xs-block.visible-sm-block.append-bottom-default .block.build-sidebar-header.visible-xs-block.visible-sm-block.append-bottom-default
Job Job
%strong ##{@build.id} %strong ##{@build.id}
......
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