diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /app/assets/javascripts/merge_request_tabs.js | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'app/assets/javascripts/merge_request_tabs.js')
-rw-r--r-- | app/assets/javascripts/merge_request_tabs.js | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/app/assets/javascripts/merge_request_tabs.js b/app/assets/javascripts/merge_request_tabs.js index 1d1c0a23fab..14e5e96d7b0 100644 --- a/app/assets/javascripts/merge_request_tabs.js +++ b/app/assets/javascripts/merge_request_tabs.js @@ -82,9 +82,9 @@ export default class MergeRequestTabs { this.mergeRequestTabPanes && this.mergeRequestTabPanes.querySelectorAll ? this.mergeRequestTabPanes.querySelectorAll('.tab-pane') : null; - const navbar = document.querySelector('.navbar-gitlab'); - const peek = document.getElementById('js-peek'); - const paddingTop = 16; + this.navbar = document.querySelector('.navbar-gitlab'); + this.peek = document.getElementById('js-peek'); + this.paddingTop = 16; this.commitsTab = document.querySelector('.tab-content .commits.tab-pane'); @@ -99,15 +99,6 @@ export default class MergeRequestTabs { this.setCurrentAction = this.setCurrentAction.bind(this); this.tabShown = this.tabShown.bind(this); this.clickTab = this.clickTab.bind(this); - this.stickyTop = navbar ? navbar.offsetHeight - paddingTop : 0; - - if (peek) { - this.stickyTop += peek.offsetHeight; - } - - if (this.mergeRequestTabs) { - this.stickyTop += this.mergeRequestTabs.offsetHeight; - } if (stubLocation) { location = stubLocation; @@ -520,4 +511,18 @@ export default class MergeRequestTabs { } }, 0); } + + get stickyTop() { + let stickyTop = this.navbar ? this.navbar.offsetHeight : 0; + + if (this.peek) { + stickyTop += this.peek.offsetHeight; + } + + if (this.mergeRequestTabs) { + stickyTop += this.mergeRequestTabs.offsetHeight; + } + + return stickyTop; + } } |