Class: Tramway::EntityComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Tramway::EntityComponent
- Defined in:
- app/components/tramway/entity_component.rb
Overview
Component for displaying an entity row in a list
Constant Summary
Constants included from Helpers::ViewsHelper
Helpers::ViewsHelper::FORM_SIZES
Instance Method Summary collapse
Methods included from Helpers::ViewsHelper
#tramway_back_button, #tramway_badge, #tramway_button, #tramway_cell, #tramway_container, #tramway_flash, #tramway_form_for, #tramway_header, #tramway_main_container, #tramway_row, #tramway_table, #tramway_title
Methods included from Helpers::ComponentHelper
Methods included from Helpers::DecorateHelper
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 |