summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Gizotti <gabriel@gizotti.com>2016-11-25 19:49:56 +1000
committerGabriel Gizotti <gabriel@gizotti.com>2016-12-16 19:13:17 +1000
commit00a842eacc4b2ff1514b258fbf08e4017f3be447 (patch)
tree5926291c6592e26a9a6860980a35ee06ef824732
parentb4764a8dd22c29b7edc3065af9a99713aa5708d3 (diff)
downloadgitlab-ce-00a842eacc4b2ff1514b258fbf08e4017f3be447.tar.gz
Add toggle links for using default message and description on change merge commit message container
-rw-r--r--app/views/projects/merge_requests/widget/open/_accept.html.haml1
-rw-r--r--app/views/shared/_commit_message_container.html.haml28
2 files changed, 29 insertions, 0 deletions
diff --git a/app/views/projects/merge_requests/widget/open/_accept.html.haml b/app/views/projects/merge_requests/widget/open/_accept.html.haml
index 435fe835fae..66096ff7476 100644
--- a/app/views/projects/merge_requests/widget/open/_accept.html.haml
+++ b/app/views/projects/merge_requests/widget/open/_accept.html.haml
@@ -41,6 +41,7 @@
Modify commit message
.js-toggle-content.hide.prepend-top-default
= render 'shared/commit_message_container', params: params,
+ description: @merge_request.description,
text: @merge_request.merge_commit_message,
rows: 14, hint: true
diff --git a/app/views/shared/_commit_message_container.html.haml b/app/views/shared/_commit_message_container.html.haml
index 0a38327baa2..adee374413f 100644
--- a/app/views/shared/_commit_message_container.html.haml
+++ b/app/views/shared/_commit_message_container.html.haml
@@ -14,3 +14,31 @@
%p.hint
Try to keep the first line under 52 characters
and the others under 72.
+ - if local_assigns[:description]
+ %p.hint.use-description-hint
+ = link_to "#", class: "use-description-link" do
+ Use Merge Request description as merge commit message
+ %p.hint.use-default-message-hint.hide
+ = link_to "#", class: "use-default-message-link" do
+ Use default Gitlab merge commit message
+
+
+ :javascript
+ $('.use-description-link').on('click', function(e) {
+ e.preventDefault();
+
+ $('.use-description-hint').hide();
+ $('.use-default-message-hint').show();
+ $('.js-commit-message').val("#{escape_javascript local_assigns[:description]}");
+ });
+
+ $('.use-default-message-link').on('click', function(e) {
+ e.preventDefault();
+
+ var defaultMessage = "#{escape_javascript (params[:commit_message] || local_assigns[:text] || local_assigns[:placeholder])}";
+
+ $('.use-description-hint').show();
+ $('.use-default-message-hint').hide();
+ $('.js-commit-message').val(defaultMessage);
+ });
+