calculate the stickyTop instead of hard coding a variable
This commit is contained in:
parent
016e750308
commit
35daaa36e0
|
@ -239,7 +239,8 @@ import Diff from './diff';
|
|||
break;
|
||||
case 'projects:compare:show':
|
||||
new Diff();
|
||||
initChangesDropdown();
|
||||
const paddingTop = 16;
|
||||
initChangesDropdown(document.querySelector('.navbar-gitlab').offsetHeight - paddingTop);
|
||||
break;
|
||||
case 'projects:branches:new':
|
||||
case 'projects:branches:create':
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import stickyMonitor from './lib/utils/sticky';
|
||||
|
||||
export default () => {
|
||||
stickyMonitor(document.querySelector('.js-diff-files-changed'), 76);
|
||||
export default (stickyTop) => {
|
||||
stickyMonitor(document.querySelector('.js-diff-files-changed'), stickyTop);
|
||||
|
||||
$('.js-diff-stats-dropdown').glDropdown({
|
||||
filterable: true,
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue