in app/helpers/button_helper.rb [32:70]
def clipboard_button(data = {})
css_class = data.delete(:class)
title = data.delete(:title) || _('Copy')
aria_keyshortcuts = data.delete(:aria_keyshortcuts) || nil
aria_label = data.delete(:aria_label) || title
button_text = data[:button_text] || nil
hide_tooltip = data[:hide_tooltip] || false
hide_button_icon = data[:hide_button_icon] || false
item_prop = data[:itemprop] || nil
variant = data[:variant] || :default
category = data[:category] || :tertiary
size = data[:size] || :small
if text = data.delete(:text)
data[:clipboard_text] =
if gfm = data.delete(:gfm)
{ text: text, gfm: gfm }
else
text
end
end
target = data.delete(:target)
data[:clipboard_target] = target if target
data = { toggle: 'tooltip', placement: 'bottom', container: 'body', html: 'true' }.merge(data) unless hide_tooltip
render ::Pajamas::ButtonComponent.new(
icon: hide_button_icon ? nil : 'copy-to-clipboard',
variant: variant,
category: category,
size: size,
button_options: { class: css_class, title: title, aria: { keyshortcuts: aria_keyshortcuts, label: aria_label, live: 'polite' }, data: data, itemprop: item_prop }) do
button_text
end
end