summaryrefslogtreecommitdiff
path: root/app/helpers/button_helper.rb
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-06-17 18:00:03 +0000
committerRobert Speicher <robert@gitlab.com>2016-06-17 18:00:03 +0000
commit6c37e0f61774e4f0c7dff7830055233b3ab2726b (patch)
tree2fe5e32a0fe5cc3bf52b653118ed50914a3934d5 /app/helpers/button_helper.rb
parent04f72a3b9641e3af5151d5cfb8ac924c138d6fe2 (diff)
parent12b39524779e36b2e52e0b64c1d85186355e9415 (diff)
downloadgitlab-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
Diffstat (limited to 'app/helpers/button_helper.rb')
-rw-r--r--app/helpers/button_helper.rb10
1 files changed, 10 insertions, 0 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'),