Module: ClipboardHelper
- Defined in:
- app/helpers/clipboard_helper.rb
Overview
Unified clipboard copy functionality.
Provides consistent copy-to-clipboard behavior across the application.
All modes include visual feedback on click via CSS animation.
Link behavior:
- If url: is provided → automatically copies as rich HTML link
- Plain text always copies the display text (not the URL)
- With include_url_in_text: true → plain text includes URL: "Text "
Instance Method Summary collapse
-
#clipboard_copy(text, mode: :icon, url: nil, link_text: nil, copy_value: nil, include_url_in_text: false, button_class: nil, title: nil) ⇒ String
Renders a clipboard copy button with visual feedback.
Instance Method Details
#clipboard_copy(text, mode: :icon, url: nil, link_text: nil, copy_value: nil, include_url_in_text: false, button_class: nil, title: nil) ⇒ String
Renders a clipboard copy button with visual feedback.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/helpers/clipboard_helper.rb', line 43 def clipboard_copy(text, mode: :icon, url: nil, link_text: nil, copy_value: nil, include_url_in_text: false, button_class: nil, title: nil) return nil if text.blank? render Crm::ClipboardButtonComponent.new( text: text, mode: mode, url: url, link_text: link_text, copy_value: copy_value, include_url_in_text: include_url_in_text, button_class: , title: title ) end |