debian-mirror-gitlab/app/assets/javascripts/init_diff_stats_dropdown.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
785 B
JavaScript
Raw Normal View History

2021-11-11 11:23:49 +05:30
import Vue from 'vue';
import DiffStatsDropdown from '~/vue_shared/components/diff_stats_dropdown.vue';
import { stickyMonitor } from './lib/utils/sticky';
export const initDiffStatsDropdown = (stickyTop) => {
if (stickyTop) {
2023-03-17 16:20:25 +05:30
stickyMonitor(document.querySelector('.js-diff-files-changed'), stickyTop, false);
2021-11-11 11:23:49 +05:30
}
const el = document.querySelector('.js-diff-stats-dropdown');
if (!el) {
return false;
}
const { changed, added, deleted, files } = el.dataset;
return new Vue({
el,
render: (createElement) =>
createElement(DiffStatsDropdown, {
props: {
changed: parseInt(changed, 10),
added: parseInt(added, 10),
deleted: parseInt(deleted, 10),
files: JSON.parse(files),
},
}),
});
};