Commit 9eae6b36 authored by Paul Slaughter's avatar Paul Slaughter

Merge branch 'jdb/decouple-upload-from-initblob' into 'master'

Decouple file uploading from initBlob

See merge request gitlab-org/gitlab!49601
parents 698882cf 1a0b6c87
......@@ -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