Unify commit message listeners in one function
This commit is contained in:
parent
943ef94912
commit
99dd58ec55
1 changed files with 6 additions and 11 deletions
|
@ -27,8 +27,7 @@
|
|||
// Prevent duplicate event bindings
|
||||
this.disableTaskList();
|
||||
this.initMRBtnListeners();
|
||||
this.initMessageWithDescriptionListener();
|
||||
this.initMessageWithoutDescriptionListener();
|
||||
this.initCommitMessageListeners();
|
||||
if ($("a.btn-close").length) {
|
||||
this.initTaskList();
|
||||
}
|
||||
|
@ -110,24 +109,20 @@
|
|||
// note so that we can re-use its form here
|
||||
};
|
||||
|
||||
MergeRequest.prototype.initMessageWithDescriptionListener = function() {
|
||||
return $('a.with-description-link').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
MergeRequest.prototype.initCommitMessageListeners = function() {
|
||||
var textarea = $('textarea.js-commit-message');
|
||||
|
||||
var textarea = $('textarea.js-commit-message');
|
||||
$('a.with-description-link').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
textarea.val(textarea.data('messageWithDescription'));
|
||||
$('p.with-description-hint').hide();
|
||||
$('p.without-description-hint').show();
|
||||
});
|
||||
};
|
||||
|
||||
MergeRequest.prototype.initMessageWithoutDescriptionListener = function() {
|
||||
return $('a.without-description-link').on('click', function(e) {
|
||||
$('a.without-description-link').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var textarea = $('textarea.js-commit-message');
|
||||
|
||||
textarea.val(textarea.data('messageWithoutDescription'));
|
||||
$('p.with-description-hint').show();
|
||||
$('p.without-description-hint').hide();
|
||||
|
|
Loading…
Reference in a new issue