Class: PhlexKit::AttachmentTrigger
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::AttachmentTrigger
- Defined in:
- app/components/phlex_kit/attachment/attachment_trigger.rb
Overview
Full-card overlay that activates the attachment (a preview link or dialog
trigger). Sits BEHIND AttachmentActions in the stacking order, so actions
stay independently clickable. Give it an aria-label; pass as: :a +
href: for a link. See attachment.rb.
Instance Method Summary collapse
-
#initialize(as: :button, href: nil, **attrs) ⇒ AttachmentTrigger
constructor
A new instance of AttachmentTrigger.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(as: :button, href: nil, **attrs) ⇒ AttachmentTrigger
Returns a new instance of AttachmentTrigger.
7 8 9 10 11 |
# File 'app/components/phlex_kit/attachment/attachment_trigger.rb', line 7 def initialize(as: :button, href: nil, **attrs) @as = as.to_sym @href = href @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'app/components/phlex_kit/attachment/attachment_trigger.rb', line 13 def view_template base = { class: "pk-attachment-trigger" } if @as == :a a(**mix(base.merge(href: @href), @attrs)) else (**mix(base.merge(type: :button), @attrs)) end end |