Commit 99dd58ec authored by Gabriel Gizotti's avatar Gabriel Gizotti

Unify commit message listeners in one function

parent 943ef949
...@@ -27,8 +27,7 @@ ...@@ -27,8 +27,7 @@
// Prevent duplicate event bindings // Prevent duplicate event bindings
this.disableTaskList(); this.disableTaskList();
this.initMRBtnListeners(); this.initMRBtnListeners();
this.initMessageWithDescriptionListener(); this.initCommitMessageListeners();
this.initMessageWithoutDescriptionListener();
if ($("a.btn-close").length) { if ($("a.btn-close").length) {
this.initTaskList(); this.initTaskList();
} }
...@@ -110,24 +109,20 @@ ...@@ -110,24 +109,20 @@
// note so that we can re-use its form here // note so that we can re-use its form here
}; };
MergeRequest.prototype.initMessageWithDescriptionListener = function() { MergeRequest.prototype.initCommitMessageListeners = function() {
return $('a.with-description-link').on('click', function(e) { var textarea = $('textarea.js-commit-message');
e.preventDefault();
var textarea = $('textarea.js-commit-message'); $('a.with-description-link').on('click', function(e) {
e.preventDefault();
textarea.val(textarea.data('messageWithDescription')); textarea.val(textarea.data('messageWithDescription'));
$('p.with-description-hint').hide(); $('p.with-description-hint').hide();
$('p.without-description-hint').show(); $('p.without-description-hint').show();
}); });
};
MergeRequest.prototype.initMessageWithoutDescriptionListener = function() { $('a.without-description-link').on('click', function(e) {
return $('a.without-description-link').on('click', function(e) {
e.preventDefault(); e.preventDefault();
var textarea = $('textarea.js-commit-message');
textarea.val(textarea.data('messageWithoutDescription')); textarea.val(textarea.data('messageWithoutDescription'));
$('p.with-description-hint').show(); $('p.with-description-hint').show();
$('p.without-description-hint').hide(); $('p.without-description-hint').hide();
......
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