Commit 9b554fe4 authored by Utkarsh Gupta's avatar Utkarsh Gupta Committed by Kushal Pandya

Remove var from merge_request.js

parent 39188cc1
/* eslint-disable func-names, no-var, no-underscore-dangle, one-var, consistent-return */ /* eslint-disable func-names, no-underscore-dangle, consistent-return */
import $ from 'jquery'; import $ from 'jquery';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -64,12 +64,10 @@ MergeRequest.prototype.showAllCommits = function() { ...@@ -64,12 +64,10 @@ MergeRequest.prototype.showAllCommits = function() {
}; };
MergeRequest.prototype.initMRBtnListeners = function() { MergeRequest.prototype.initMRBtnListeners = function() {
var _this; const _this = this;
_this = this;
return $('a.btn-close, a.btn-reopen').on('click', function(e) { return $('a.btn-close, a.btn-reopen').on('click', function(e) {
var $this, shouldSubmit; const $this = $(this);
$this = $(this); const shouldSubmit = $this.hasClass('btn-comment');
shouldSubmit = $this.hasClass('btn-comment');
if (shouldSubmit && $this.data('submitted')) { if (shouldSubmit && $this.data('submitted')) {
return; return;
} }
...@@ -88,8 +86,7 @@ MergeRequest.prototype.initMRBtnListeners = function() { ...@@ -88,8 +86,7 @@ MergeRequest.prototype.initMRBtnListeners = function() {
}; };
MergeRequest.prototype.submitNoteForm = function(form, $button) { MergeRequest.prototype.submitNoteForm = function(form, $button) {
var noteText; const noteText = form.find('textarea.js-note-text').val();
noteText = form.find('textarea.js-note-text').val();
if (noteText.trim().length > 0) { if (noteText.trim().length > 0) {
form.submit(); form.submit();
$button.data('submitted', true); $button.data('submitted', true);
...@@ -99,7 +96,7 @@ MergeRequest.prototype.submitNoteForm = function(form, $button) { ...@@ -99,7 +96,7 @@ MergeRequest.prototype.submitNoteForm = function(form, $button) {
MergeRequest.prototype.initCommitMessageListeners = function() { MergeRequest.prototype.initCommitMessageListeners = function() {
$(document).on('click', 'a.js-with-description-link', e => { $(document).on('click', 'a.js-with-description-link', e => {
var textarea = $('textarea.js-commit-message'); const textarea = $('textarea.js-commit-message');
e.preventDefault(); e.preventDefault();
textarea.val(textarea.data('messageWithDescription')); textarea.val(textarea.data('messageWithDescription'));
...@@ -108,7 +105,7 @@ MergeRequest.prototype.initCommitMessageListeners = function() { ...@@ -108,7 +105,7 @@ MergeRequest.prototype.initCommitMessageListeners = function() {
}); });
$(document).on('click', 'a.js-without-description-link', e => { $(document).on('click', 'a.js-without-description-link', e => {
var textarea = $('textarea.js-commit-message'); const textarea = $('textarea.js-commit-message');
e.preventDefault(); e.preventDefault();
textarea.val(textarea.data('messageWithoutDescription')); textarea.val(textarea.data('messageWithoutDescription'));
......
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