mirror of
https://github.com/manyfold3d/manyfold.git
synced 2026-10-22 11:42:19 -05:00
17 lines
435 B
Ruby
17 lines
435 B
Ruby
class Components::CopyButton < Components::Base
|
|
def initialize(text:, label: nil)
|
|
@text = text
|
|
@label = label
|
|
end
|
|
|
|
def before_template
|
|
@label ||= t("components.copy_button.copy")
|
|
end
|
|
|
|
def view_template
|
|
button class: "btn btn-secondary", data: {controller: "copy-text", action: "click->copy-text#copy:prevent", copy_text_text_value: @text} do
|
|
Icon icon: "clipboard-plus", label: @label
|
|
end
|
|
end
|
|
end
|