Commit 1a0b6c87 authored by Justin Boyson's avatar Justin Boyson Committed by Paul Slaughter

Decouple file uploading from initBlob

https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49601
parent 97f3ae0f
......@@ -38,9 +38,20 @@ const initPopovers = () => {
}
};
export const initUploadForm = () => {
const uploadBlobForm = $('.js-upload-blob-form');
if (uploadBlobForm.length) {
const method = uploadBlobForm.data('method');
new BlobFileDropzone(uploadBlobForm, method);
new NewCommitForm(uploadBlobForm);
disableButtonIfEmptyField(uploadBlobForm.find('.js-commit-message'), '.btn-upload-file');
}
};
export default () => {
const editBlobForm = $('.js-edit-blob-form');
const uploadBlobForm = $('.js-upload-blob-form');
const deleteBlobForm = $('.js-delete-blob-form');
if (editBlobForm.length) {
......@@ -80,14 +91,7 @@ export default () => {
window.onbeforeunload = () => '';
}
if (uploadBlobForm.length) {
const method = uploadBlobForm.data('method');
new BlobFileDropzone(uploadBlobForm, method);
new NewCommitForm(uploadBlobForm);
disableButtonIfEmptyField(uploadBlobForm.find('.js-commit-message'), '.btn-upload-file');
}
initUploadForm();
if (deleteBlobForm.length) {
new NewCommitForm(deleteBlobForm);
......
import initTree from 'ee_else_ce/repository';
import initBlob from '~/blob_edit/blob_bundle';
import { initUploadForm } from '~/blob_edit/blob_bundle';
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import NotificationsForm from '~/notifications_form';
import UserCallout from '~/user_callout';
......@@ -26,7 +26,7 @@ new UserCallout({
// Project show page loads different overview content based on user preferences
const treeSlider = document.getElementById('js-tree-list');
if (treeSlider) {
initBlob();
initUploadForm();
initTree();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment