Class: Koi::Tables::Cells::LinkComponent
- Inherits:
-
Katalyst::Tables::CellComponent
- Object
- Katalyst::Tables::CellComponent
- Koi::Tables::Cells::LinkComponent
- Defined in:
- app/components/koi/tables/cells/link_component.rb
Overview
Displays a link to the record The link text is the value of the attribute
Instance Method Summary collapse
-
#initialize(url:, link:) ⇒ LinkComponent
constructor
A new instance of LinkComponent.
- #rendered_value ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(url:, link:) ⇒ LinkComponent
Returns a new instance of LinkComponent.
11 12 13 14 15 16 17 |
# File 'app/components/koi/tables/cells/link_component.rb', line 11 def initialize(url:, link:, **) super(**) @url = url self.link_attributes = link end |
Instance Method Details
#rendered_value ⇒ Object
19 20 21 |
# File 'app/components/koi/tables/cells/link_component.rb', line 19 def rendered_value link_to(value, url, **link_attributes) end |
#url ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/components/koi/tables/cells/link_component.rb', line 23 def url case @url when Symbol # helpers are not available until the component is rendered @url = helpers.public_send(@url, record) when Proc @url = @url.call(record) else @url end end |