Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/blob_edit/blob_bundle.js')
-rw-r--r--app/assets/javascripts/blob_edit/blob_bundle.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/assets/javascripts/blob_edit/blob_bundle.js b/app/assets/javascripts/blob_edit/blob_bundle.js
new file mode 100644
index 00000000000..c5deccf631e
--- /dev/null
+++ b/app/assets/javascripts/blob_edit/blob_bundle.js
@@ -0,0 +1,32 @@
+/* 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 */
+/* global NewCommitForm */
+
+import EditBlob from './edit_blob';
+import BlobFileDropzone from '../blob/blob_file_dropzone';
+
+$(() => {
+ const editBlobForm = $('.js-edit-blob-form');
+ const uploadBlobForm = $('.js-upload-blob-form');
+
+ if (editBlobForm.length) {
+ const urlRoot = editBlobForm.data('relative-url-root');
+ const assetsPath = editBlobForm.data('assets-prefix');
+ const blobLanguage = editBlobForm.data('blob-language');
+
+ new EditBlob(`${urlRoot}${assetsPath}`, blobLanguage);
+ 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',
+ );
+ }
+});