Class: Ariadne::TableComponent
- Defined in:
- app/components/ariadne/table_component.rb
Overview
Add a general description of component here Add additional usage considerations or best practices that may aid the user to use the component correctly.
Defined Under Namespace
Classes: FooterItem, HeaderRowItem, PaginationBarItem, RowItem
Constant Summary collapse
- DEFAULT_CLASSES =
"ariadne-min-w-full ariadne-divide-y ariadne-divide-gray-300 flex flex-col"
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
- #has_footer? ⇒ Boolean
- #has_header_row? ⇒ Boolean
-
#initialize(classes: "", attributes: {}) ⇒ TableComponent
constructor
<%= render(Ariadne::TableComponent.new) do |table| %> <%= table.header_row do |header_row| %> <% header_row.cell do %> State <% end %> <% end %> <%= table.row do |row| %> <% row.cell do %> “California” <% end %> <% end %> <%= table.row do |row| %> <% row.cell do %> “New York” <% end %> <% end %> <%= table.row do |row| %> <% row.cell do %> “Texas” <% end %> <% end %> <% end %>.
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(classes: "", attributes: {}) ⇒ TableComponent
<%= render(Ariadne::TableComponent.new) do |table| %>
<%= table.header_row do |header_row| %>
<% header_row.cell do %>
State
<% end %>
<% end %>
<%= table.row do |row| %>
<% row.cell do %>
"California"
<% end %>
<% end %>
<%= table.row do |row| %>
<% row.cell do %>
"New York"
<% end %>
<% end %>
<%= table.row do |row| %>
<% row.cell do %>
"Texas"
<% end %>
<% end %>
<% end %>
42 43 44 45 46 47 48 49 50 |
# File 'app/components/ariadne/table_component.rb', line 42 def initialize(classes: "", attributes: {}) @tag = :div @classes = class_names( DEFAULT_CLASSES, classes, ) @attributes = attributes end |
Instance Method Details
#has_footer? ⇒ Boolean
56 57 58 |
# File 'app/components/ariadne/table_component.rb', line 56 def .present? end |
#has_header_row? ⇒ Boolean
52 53 54 |
# File 'app/components/ariadne/table_component.rb', line 52 def has_header_row? header_row.present? end |