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 = () => { ...@@ -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 () => { export default () => {
const editBlobForm = $('.js-edit-blob-form'); const editBlobForm = $('.js-edit-blob-form');
const uploadBlobForm = $('.js-upload-blob-form');
const deleteBlobForm = $('.js-delete-blob-form'); const deleteBlobForm = $('.js-delete-blob-form');
if (editBlobForm.length) { if (editBlobForm.length) {
...@@ -80,14 +91,7 @@ export default () => { ...@@ -80,14 +91,7 @@ export default () => {
window.onbeforeunload = () => ''; window.onbeforeunload = () => '';
} }
if (uploadBlobForm.length) { initUploadForm();
const method = uploadBlobForm.data('method');
new BlobFileDropzone(uploadBlobForm, method);
new NewCommitForm(uploadBlobForm);
disableButtonIfEmptyField(uploadBlobForm.find('.js-commit-message'), '.btn-upload-file');
}
if (deleteBlobForm.length) { if (deleteBlobForm.length) {
new NewCommitForm(deleteBlobForm); new NewCommitForm(deleteBlobForm);
......
import initTree from 'ee_else_ce/repository'; 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 ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import NotificationsForm from '~/notifications_form'; import NotificationsForm from '~/notifications_form';
import UserCallout from '~/user_callout'; import UserCallout from '~/user_callout';
...@@ -26,7 +26,7 @@ new UserCallout({ ...@@ -26,7 +26,7 @@ new UserCallout({
// Project show page loads different overview content based on user preferences // Project show page loads different overview content based on user preferences
const treeSlider = document.getElementById('js-tree-list'); const treeSlider = document.getElementById('js-tree-list');
if (treeSlider) { if (treeSlider) {
initBlob(); initUploadForm();
initTree(); 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