BigW Consortium Gitlab

calculate the stickyTop instead of hard coding a variable

parent 016e7503
...@@ -239,7 +239,8 @@ import Diff from './diff'; ...@@ -239,7 +239,8 @@ import Diff from './diff';
break; break;
case 'projects:compare:show': case 'projects:compare:show':
new Diff(); new Diff();
initChangesDropdown(); const paddingTop = 16;
initChangesDropdown(document.querySelector('.navbar-gitlab').offsetHeight - paddingTop);
break; break;
case 'projects:branches:new': case 'projects:branches:new':
case 'projects:branches:create': case 'projects:branches:create':
......
import stickyMonitor from './lib/utils/sticky'; import stickyMonitor from './lib/utils/sticky';
export default () => { export default (stickyTop) => {
stickyMonitor(document.querySelector('.js-diff-files-changed'), 76); stickyMonitor(document.querySelector('.js-diff-files-changed'), stickyTop);
$('.js-diff-stats-dropdown').glDropdown({ $('.js-diff-stats-dropdown').glDropdown({
filterable: true, filterable: true,
......
...@@ -67,6 +67,9 @@ import Diff from './diff'; ...@@ -67,6 +67,9 @@ import Diff from './diff';
class MergeRequestTabs { class MergeRequestTabs {
constructor({ action, setUrl, stubLocation } = {}) { constructor({ action, setUrl, stubLocation } = {}) {
const mergeRequestTabs = document.querySelector('.js-tabs-affix');
const paddingTop = 16;
this.diffsLoaded = false; this.diffsLoaded = false;
this.pipelinesLoaded = false; this.pipelinesLoaded = false;
this.commitsLoaded = false; this.commitsLoaded = false;
...@@ -76,6 +79,11 @@ import Diff from './diff'; ...@@ -76,6 +79,11 @@ import Diff from './diff';
this.setCurrentAction = this.setCurrentAction.bind(this); this.setCurrentAction = this.setCurrentAction.bind(this);
this.tabShown = this.tabShown.bind(this); this.tabShown = this.tabShown.bind(this);
this.showTab = this.showTab.bind(this); this.showTab = this.showTab.bind(this);
this.stickyTop = document.querySelector('.navbar-gitlab').offsetHeight - paddingTop;
if (mergeRequestTabs) {
this.stickyTop += mergeRequestTabs.offsetHeight;
}
if (stubLocation) { if (stubLocation) {
location = stubLocation; location = stubLocation;
...@@ -278,7 +286,7 @@ import Diff from './diff'; ...@@ -278,7 +286,7 @@ import Diff from './diff';
const $container = $('#diffs'); const $container = $('#diffs');
$container.html(data.html); $container.html(data.html);
initChangesDropdown(); initChangesDropdown(this.stickyTop);
if (typeof gl.diffNotesCompileComponents !== 'undefined') { if (typeof gl.diffNotesCompileComponents !== 'undefined') {
gl.diffNotesCompileComponents(); gl.diffNotesCompileComponents();
......
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