diff options
author | Gabriel Gizotti <gabriel@gizotti.com> | 2016-12-05 20:46:43 +1000 |
---|---|---|
committer | Gabriel Gizotti <gabriel@gizotti.com> | 2016-12-16 19:13:17 +1000 |
commit | 99dd58ec557779eadd83aa597d8c16996be60df1 (patch) | |
tree | cffa026919cd89e1210f68e3d2b4a953d0e2595b /app/assets/javascripts/merge_request.js | |
parent | 943ef94912410dd028626711c97cd1ae881a5e4c (diff) | |
download | gitlab-ce-99dd58ec557779eadd83aa597d8c16996be60df1.tar.gz |
Unify commit message listeners in one function
Diffstat (limited to 'app/assets/javascripts/merge_request.js')
-rw-r--r-- | app/assets/javascripts/merge_request.js | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/app/assets/javascripts/merge_request.js b/app/assets/javascripts/merge_request.js index 309724071d2..194a27ae22b 100644 --- a/app/assets/javascripts/merge_request.js +++ b/app/assets/javascripts/merge_request.js @@ -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(); |