2018-11-08 19:23:39 +05:30
|
|
|
/* eslint-disable no-new */
|
2018-05-09 12:01:36 +05:30
|
|
|
|
|
|
|
import $ from 'jquery';
|
2018-03-17 18:26:18 +05:30
|
|
|
import NewCommitForm from '../new_commit_form';
|
2017-08-17 22:00:37 +05:30
|
|
|
import EditBlob from './edit_blob';
|
|
|
|
import BlobFileDropzone from '../blob/blob_file_dropzone';
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
export default () => {
|
2017-08-17 22:00:37 +05:30
|
|
|
const editBlobForm = $('.js-edit-blob-form');
|
|
|
|
const uploadBlobForm = $('.js-upload-blob-form');
|
2017-09-10 17:25:29 +05:30
|
|
|
const deleteBlobForm = $('.js-delete-blob-form');
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
if (editBlobForm.length) {
|
2018-03-27 19:54:05 +05:30
|
|
|
const urlRoot = editBlobForm.data('relativeUrlRoot');
|
|
|
|
const assetsPath = editBlobForm.data('assetsPrefix');
|
|
|
|
const blobLanguage = editBlobForm.data('blobLanguage');
|
|
|
|
const currentAction = $('.js-file-title').data('currentAction');
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
new EditBlob(`${urlRoot}${assetsPath}`, blobLanguage, currentAction);
|
|
|
|
new NewCommitForm(editBlobForm);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (uploadBlobForm.length) {
|
|
|
|
const method = uploadBlobForm.data('method');
|
|
|
|
|
|
|
|
new BlobFileDropzone(uploadBlobForm, method);
|
|
|
|
new NewCommitForm(uploadBlobForm);
|
|
|
|
|
|
|
|
window.gl.utils.disableButtonIfEmptyField(
|
|
|
|
uploadBlobForm.find('.js-commit-message'),
|
|
|
|
'.btn-upload-file',
|
|
|
|
);
|
|
|
|
}
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
if (deleteBlobForm.length) {
|
|
|
|
new NewCommitForm(deleteBlobForm);
|
|
|
|
}
|
2018-03-27 19:54:05 +05:30
|
|
|
};
|