summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/new_commit_form.js
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-11-20 20:28:29 +0000
committerFilipa Lacerda <filipa@gitlab.com>2017-11-20 20:28:29 +0000
commit030de8b32889eae832d512f30079403e0da7f699 (patch)
treed3c03048ae5995dfb85ccfbb33bde4e662500350 /app/assets/javascripts/new_commit_form.js
parent2b594daf9aa10f9a6469addb52f0df283f5347fb (diff)
downloadgitlab-ce-030de8b32889eae832d512f30079403e0da7f699.tar.gz
Export code as ES6 modules38869-milestone
Diffstat (limited to 'app/assets/javascripts/new_commit_form.js')
-rw-r--r--app/assets/javascripts/new_commit_form.js54
1 files changed, 25 insertions, 29 deletions
diff --git a/app/assets/javascripts/new_commit_form.js b/app/assets/javascripts/new_commit_form.js
index 04073ef7270..6e152497d20 100644
--- a/app/assets/javascripts/new_commit_form.js
+++ b/app/assets/javascripts/new_commit_form.js
@@ -1,32 +1,28 @@
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-return-assign, max-len */
-(function() {
- this.NewCommitForm = (function() {
- function NewCommitForm(form) {
- this.form = form;
- this.renderDestination = this.renderDestination.bind(this);
- this.branchName = form.find('.js-branch-name');
- this.originalBranch = form.find('.js-original-branch');
- this.createMergeRequest = form.find('.js-create-merge-request');
- this.createMergeRequestContainer = form.find('.js-create-merge-request-container');
- this.branchName.keyup(this.renderDestination);
- this.renderDestination();
- }
+export default class NewCommitForm {
+ constructor(form) {
+ this.form = form;
+ this.renderDestination = this.renderDestination.bind(this);
+ this.branchName = form.find('.js-branch-name');
+ this.originalBranch = form.find('.js-original-branch');
+ this.createMergeRequest = form.find('.js-create-merge-request');
+ this.createMergeRequestContainer = form.find('.js-create-merge-request-container');
+ this.branchName.keyup(this.renderDestination);
+ this.renderDestination();
+ }
- NewCommitForm.prototype.renderDestination = function() {
- var different;
- different = this.branchName.val() !== this.originalBranch.val();
- if (different) {
- this.createMergeRequestContainer.show();
- if (!this.wasDifferent) {
- this.createMergeRequest.prop('checked', true);
- }
- } else {
- this.createMergeRequestContainer.hide();
- this.createMergeRequest.prop('checked', false);
+ renderDestination() {
+ var different;
+ different = this.branchName.val() !== this.originalBranch.val();
+ if (different) {
+ this.createMergeRequestContainer.show();
+ if (!this.wasDifferent) {
+ this.createMergeRequest.prop('checked', true);
}
- return this.wasDifferent = different;
- };
-
- return NewCommitForm;
- })();
-}).call(window);
+ } else {
+ this.createMergeRequestContainer.hide();
+ this.createMergeRequest.prop('checked', false);
+ }
+ return this.wasDifferent = different;
+ }
+}