diff options
author | Gabriel Gizotti <gabriel@gizotti.com> | 2016-11-28 07:37:57 +1000 |
---|---|---|
committer | Gabriel Gizotti <gabriel@gizotti.com> | 2016-12-16 19:13:17 +1000 |
commit | d1980ef9c8c059fb9d4be1a8339dea05e9a442f1 (patch) | |
tree | ec07bc6173d2b64e3e054516e24b3803d426e5b0 /app | |
parent | 1a72dc2486601eadec03122f8124d3b553df3571 (diff) | |
download | gitlab-ce-d1980ef9c8c059fb9d4be1a8339dea05e9a442f1.tar.gz |
only render MR description toggle javascript if description is available
Diffstat (limited to 'app')
-rw-r--r-- | app/views/shared/_commit_message_container.html.haml | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/app/views/shared/_commit_message_container.html.haml b/app/views/shared/_commit_message_container.html.haml index 706eef5a331..a151731ba0a 100644 --- a/app/views/shared/_commit_message_container.html.haml +++ b/app/views/shared/_commit_message_container.html.haml @@ -14,7 +14,7 @@ %p.hint Try to keep the first line under 52 characters and the others under 72. - - if local_assigns[:description] + - if local_assigns[:description] %p.hint.use-description-hint = link_to "#", class: "use-description-link" do Use Merge Request description as merge commit message @@ -22,29 +22,28 @@ = link_to "#", class: "use-default-message-link" do Use default Gitlab merge commit message + :javascript + $('.use-description-link').on('click', function(e) { + e.preventDefault(); - :javascript - $('.use-description-link').on('click', function(e) { - e.preventDefault(); + var message = "Merge branch '#{j @merge_request.source_branch}' into '#{j @merge_request.target_branch}'\n\n" + message = message + "#{j @merge_request.title}\n\n" + message = message + "#{j local_assigns[:description]}\n\n"; + message = message + "See merge request #{j @merge_request.to_reference}" - var message = "Merge branch '#{j @merge_request.source_branch}' into '#{j @merge_request.target_branch}'\n\n" - message = message + "#{j @merge_request.title}\n\n" - message = message + "#{j local_assigns[:description]}\n\n"; - message = message + "See merge request #{j @merge_request.to_reference}" + $('.use-description-hint').hide(); + $('.use-default-message-hint').show(); + $('.js-commit-message').val(message) + }); - $('.use-description-hint').hide(); - $('.use-default-message-hint').show(); - $('.js-commit-message').val(message) - }); + $('.use-default-message-link').on('click', function(e) { + e.preventDefault(); - $('.use-default-message-link').on('click', function(e) { - e.preventDefault(); + var defaultMessage = "#{j (params[:commit_message] || local_assigns[:text] || local_assigns[:placeholder])}"; - var defaultMessage = "#{j (params[:commit_message] || local_assigns[:text] || local_assigns[:placeholder])}"; - - $('.use-description-hint').show(); - $('.use-default-message-hint').hide(); - $('.js-commit-message').val(defaultMessage); - }); + $('.use-description-hint').show(); + $('.use-default-message-hint').hide(); + $('.js-commit-message').val(defaultMessage); + }); |