debian-mirror-gitlab/app/assets/javascripts/pages/projects/show/index.js
2020-06-23 00:09:42 +05:30

65 lines
2.1 KiB
JavaScript

import $ from 'jquery';
import 'jquery.waitforimages';
import initBlob from '~/blob_edit/blob_bundle';
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import NotificationsForm from '~/notifications_form';
import UserCallout from '~/user_callout';
import TreeView from '~/tree';
import BlobViewer from '~/blob/viewer/index';
import Activities from '~/activities';
import { ajaxGet } from '~/lib/utils/common_utils';
import GpgBadges from '~/gpg_badges';
import initReadMore from '~/read_more';
import leaveByUrl from '~/namespaces/leave_by_url';
import Star from '../../../star';
import notificationsDropdown from '../../../notifications_dropdown';
import initNamespaceStorageLimitAlert from '~/namespace_storage_limit_alert';
import { showLearnGitLabProjectPopover } from '~/onboarding_issues';
document.addEventListener('DOMContentLoaded', () => {
initReadMore();
initNamespaceStorageLimitAlert();
new Star(); // eslint-disable-line no-new
notificationsDropdown();
new ShortcutsNavigation(); // eslint-disable-line no-new
new NotificationsForm(); // eslint-disable-line no-new
// eslint-disable-next-line no-new
new UserCallout({
setCalloutPerProject: false,
className: 'js-autodevops-banner',
});
// Project show page loads different overview content based on user preferences
const treeSlider = document.querySelector('#tree-slider');
if (treeSlider) {
new TreeView(); // eslint-disable-line no-new
initBlob();
}
if (document.querySelector('.blob-viewer')) {
new BlobViewer(); // eslint-disable-line no-new
}
if (document.querySelector('.project-show-activity')) {
new Activities(); // eslint-disable-line no-new
}
$(treeSlider).waitForImages(() => {
ajaxGet(document.querySelector('.js-tree-content').dataset.logsPath);
});
GpgBadges.fetch();
leaveByUrl('project');
if (document.getElementById('js-tree-list')) {
initBlob();
import('ee_else_ce/repository')
.then(m => m.default())
.catch(e => {
throw e;
});
}
showLearnGitLabProjectPopover();
});