diff options
author | Phil Hughes <me@iamphill.com> | 2017-10-23 10:21:38 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-10-23 10:38:39 +0100 |
commit | 35daaa36e0ee74e28422a3b088fd5b01249ea9b7 (patch) | |
tree | a7bd88120aef0b73a73214800ebd84570de51f38 /app/assets/javascripts/merge_request_tabs.js | |
parent | 016e750308b6e927b53d8c050b3f3bb60e9ca4aa (diff) | |
download | gitlab-ce-35daaa36e0ee74e28422a3b088fd5b01249ea9b7.tar.gz |
calculate the stickyTop instead of hard coding a variable
Diffstat (limited to 'app/assets/javascripts/merge_request_tabs.js')
-rw-r--r-- | app/assets/javascripts/merge_request_tabs.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/assets/javascripts/merge_request_tabs.js b/app/assets/javascripts/merge_request_tabs.js index 789ccf48190..e64eb60231a 100644 --- a/app/assets/javascripts/merge_request_tabs.js +++ b/app/assets/javascripts/merge_request_tabs.js @@ -67,6 +67,9 @@ import Diff from './diff'; class MergeRequestTabs { constructor({ action, setUrl, stubLocation } = {}) { + const mergeRequestTabs = document.querySelector('.js-tabs-affix'); + const paddingTop = 16; + this.diffsLoaded = false; this.pipelinesLoaded = false; this.commitsLoaded = false; @@ -76,6 +79,11 @@ import Diff from './diff'; this.setCurrentAction = this.setCurrentAction.bind(this); this.tabShown = this.tabShown.bind(this); this.showTab = this.showTab.bind(this); + this.stickyTop = document.querySelector('.navbar-gitlab').offsetHeight - paddingTop; + + if (mergeRequestTabs) { + this.stickyTop += mergeRequestTabs.offsetHeight; + } if (stubLocation) { location = stubLocation; @@ -278,7 +286,7 @@ import Diff from './diff'; const $container = $('#diffs'); $container.html(data.html); - initChangesDropdown(); + initChangesDropdown(this.stickyTop); if (typeof gl.diffNotesCompileComponents !== 'undefined') { gl.diffNotesCompileComponents(); |