gitlab-org--gitlab-foss/app/assets/javascripts/blob_edit/blob_bundle.js

38 lines
1.2 KiB
JavaScript
Raw Normal View History

/* eslint-disable func-names, space-before-function-paren, prefer-arrow-callback, no-var, quotes, vars-on-top, no-unused-vars, no-new, max-len */
/* global EditBlob */
2017-11-20 20:28:29 +00:00
import NewCommitForm from '../new_commit_form';
import EditBlob from './edit_blob';
import BlobFileDropzone from '../blob/blob_file_dropzone';
2018-02-21 20:22:56 +00:00
export default () => {
const editBlobForm = $('.js-edit-blob-form');
const uploadBlobForm = $('.js-upload-blob-form');
2017-08-01 08:50:59 +00:00
const deleteBlobForm = $('.js-delete-blob-form');
if (editBlobForm.length) {
2018-02-20 22:20:48 +00:00
const urlRoot = editBlobForm.data('relativeUrlRoot');
const assetsPath = editBlobForm.data('assetsPrefix');
const blobLanguage = editBlobForm.data('blobLanguage');
const currentAction = $('.js-file-title').data('currentAction');
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-08-01 08:50:59 +00:00
if (deleteBlobForm.length) {
new NewCommitForm(deleteBlobForm);
}
2018-02-21 20:22:56 +00:00
};