summaryrefslogtreecommitdiff
path: root/app/assets/javascripts
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r--app/assets/javascripts/merge_request.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/app/assets/javascripts/merge_request.js b/app/assets/javascripts/merge_request.js
index 70f9a8d1955..309724071d2 100644
--- a/app/assets/javascripts/merge_request.js
+++ b/app/assets/javascripts/merge_request.js
@@ -27,6 +27,8 @@
// Prevent duplicate event bindings
this.disableTaskList();
this.initMRBtnListeners();
+ this.initMessageWithDescriptionListener();
+ this.initMessageWithoutDescriptionListener();
if ($("a.btn-close").length) {
this.initTaskList();
}
@@ -108,6 +110,30 @@
// 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();
+
+ var textarea = $('textarea.js-commit-message');
+
+ 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) {
+ e.preventDefault();
+
+ var textarea = $('textarea.js-commit-message');
+
+ textarea.val(textarea.data('messageWithoutDescription'));
+ $('p.with-description-hint').show();
+ $('p.without-description-hint').hide();
+ });
+ };
+
return MergeRequest;
})();