Class: Ariadne::TableComponent::RowItem
- Defined in:
- app/components/ariadne/table_component.rb
Overview
This component is part of TableComponent and should not be used as a standalone component.
Direct Known Subclasses
Defined Under Namespace
Classes: CellItem, HeaderCellItem
Constant Summary collapse
- DEFAULT_ROW_CLASSES =
"ariadne-whitespace-nowrap ariadne-py-4 ariadne-pl-4 ariadne-pr-3 ariadne-text-sm sm:ariadne-pl-6 flex flex-row"
Constants inherited from Component
Component::BASE_BODY_CLASSES, Component::BASE_HTML_CLASSES, Component::BASE_MAIN_CLASSES, Component::BASE_WRAPPER_CLASSES, Component::INVALID_ARIA_LABEL_TAGS
Constants included from ActionViewExtensions::FormHelper
ActionViewExtensions::FormHelper::DEFAULT_FORM_CLASSES
Constants included from Status::Dsl
Constants included from ViewHelper
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::INTEGER_TYPES, FetchOrFallbackHelper::InvalidValueError, FetchOrFallbackHelper::TRUE_OR_FALSE
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(link: "", classes: "", attributes: {}) ⇒ RowItem
constructor
A new instance of RowItem.
Methods included from ActionViewExtensions::FormHelper
Methods included from ClassNameHelper
Methods included from LoggerHelper
#logger, #silence_deprecations?, #silence_warnings?
Methods included from FetchOrFallbackHelper
#check_incoming_attribute, #check_incoming_tag, #check_incoming_value, #fetch_or_raise, #fetch_or_raise_boolean, #fetch_or_raise_integer
Constructor Details
#initialize(link: "", classes: "", attributes: {}) ⇒ RowItem
Returns a new instance of RowItem.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'app/components/ariadne/table_component.rb', line 74 def initialize(link: "", classes: "", attributes: {}) @header = false @link = link @classes = if @link.present? class_names( DEFAULT_ROW_CLASSES, "ariadne-cursor-pointer", classes, ) else class_names( DEFAULT_ROW_CLASSES, classes, ) end @attributes = attributes end |
Instance Method Details
#call ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'app/components/ariadne/table_component.rb', line 94 def call render(Ariadne::BaseComponent.new(tag: :li, classes: @classes, attributes: @attributes)) do if linked? render(Ariadne::LinkComponent.new(href: @link[:href], classes: @link[:classes], attributes: @link[:attributes])) do cells.each do |cell| concat(cell) end end else cells.each do |cell| concat(cell) end end end end |