diff options
author | Robert Speicher <robert@gitlab.com> | 2016-06-17 18:00:03 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-06-17 18:00:03 +0000 |
commit | 6c37e0f61774e4f0c7dff7830055233b3ab2726b (patch) | |
tree | 2fe5e32a0fe5cc3bf52b653118ed50914a3934d5 | |
parent | 04f72a3b9641e3af5151d5cfb8ac924c138d6fe2 (diff) | |
parent | 12b39524779e36b2e52e0b64c1d85186355e9415 (diff) | |
download | gitlab-ce-6c37e0f61774e4f0c7dff7830055233b3ab2726b.tar.gz |
Merge branch 'clipboard-buttons-fix' into 'master'
Fix clipboard buttons on "Check out branch" modal.
Closes #18794
See merge request !4760
-rw-r--r-- | app/helpers/button_helper.rb | 10 | ||||
-rw-r--r-- | app/views/projects/merge_requests/show/_how_to_merge.html.haml | 6 |
2 files changed, 13 insertions, 3 deletions
diff --git a/app/helpers/button_helper.rb b/app/helpers/button_helper.rb index 8420b7652f1..9051a493b9b 100644 --- a/app/helpers/button_helper.rb +++ b/app/helpers/button_helper.rb @@ -22,6 +22,16 @@ module ButtonHelper type: :button end + # Output a "Copy to Clipboard" button with a custom CSS class + # + # data - Data attributes passed to `content_tag` + # css_class - Class passed to the `content_tag` + # + # Examples: + # + # # Define the target element + # clipboard_button_with_class({clipboard_target: "div#foo"}, css_class: "btn-clipboard") + # # => "<button class='btn btn-clipboard' data-clipboard-target='div#foo'>...</button>" def clipboard_button_with_class(data = {}, css_class: 'btn-clipboard') content_tag :button, icon('clipboard'), diff --git a/app/views/projects/merge_requests/show/_how_to_merge.html.haml b/app/views/projects/merge_requests/show/_how_to_merge.html.haml index 0dbd159298e..b3bea900d42 100644 --- a/app/views/projects/merge_requests/show/_how_to_merge.html.haml +++ b/app/views/projects/merge_requests/show/_how_to_merge.html.haml @@ -8,7 +8,7 @@ %p %strong Step 1. Fetch and check out the branch for this merge request - = clipboard_button(clipboard_target: 'pre#merge-info-1') + = clipboard_button_with_class({clipboard_target: "pre#merge-info-1"}, css_class: "btn-clipboard") %pre.dark#merge-info-1 - if @merge_request.for_fork? :preserve @@ -25,7 +25,7 @@ %p %strong Step 3. Merge the branch and fix any conflicts that come up - = clipboard_button(clipboard_target: 'pre#merge-info-3') + = clipboard_button_with_class({clipboard_target: "pre#merge-info-3"}, css_class: "btn-clipboard") %pre.dark#merge-info-3 - if @merge_request.for_fork? :preserve @@ -38,7 +38,7 @@ %p %strong Step 4. Push the result of the merge to GitLab - = clipboard_button(clipboard_target: 'pre#merge-info-4') + = clipboard_button_with_class({clipboard_target: "pre#merge-info-4"}, css_class: "btn-clipboard") %pre.dark#merge-info-4 :preserve git push origin #{h @merge_request.target_branch} |