Class: Tramway::EntityComponent
Overview
Component for displaying an entity row in a list
Instance Method Summary
collapse
#tramway_back_button, #tramway_badge, #tramway_button, #tramway_cell, #tramway_container, #tramway_form_for, #tramway_header, #tramway_row, #tramway_table, #tramway_title
#component
#tramway_decorate
Instance Method Details
#cells ⇒ Object
22
23
24
25
26
|
# File 'app/components/tramway/entity_component.rb', line 22
def cells
decorated_item.class.index_attributes.reduce({}) do |hash, attribute|
hash.merge! attribute => decorated_item.public_send(attribute)
end
end
|
#decorated_item ⇒ Object
10
11
12
|
# File 'app/components/tramway/entity_component.rb', line 10
def decorated_item
tramway_decorate item, namespace: entity.namespace
end
|
#href ⇒ Object
14
15
16
17
18
19
20
|
# File 'app/components/tramway/entity_component.rb', line 14
def href
if entity.pages.find { _1.action == 'show' }.present?
Tramway::Engine.routes.url_helpers.public_send entity.routes.show, decorated_item.id
else
decorated_item.show_path
end
end
|