Commit 00a842ea authored by Gabriel Gizotti's avatar Gabriel Gizotti

Add toggle links for using default message and description on change merge commit message container

parent b4764a8d
......@@ -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
......
......@@ -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);
});
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