Class: Ariadne::TableNavComponent
- Defined in:
- app/components/ariadne/table_nav_component.rb
Overview
The TableNavComponent is used to render a table navigation.
Direct Known Subclasses
Defined Under Namespace
Classes: BaseCellItem, BaseRowItem, FooterItem, PaginationBarItem
Constant Summary collapse
- DEFAULT_CLASSES =
"ariadne-min-w-full ariadne-divide-y ariadne-divide-gray-300"- DEFAULT_TAG =
:table
Constants inherited from Component
Component::BASE_HIDDEN_CLASS, 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: {}) ⇒ TableNavComponent
constructor
<%= render(Ariadne::TableNavComponent.new) do |table| %> <%= table.header_row do |header_row| %> <% header_row.selection_cell do %> Status <% end %> <% header_row.main_cell do %> State <% end %> <% header_row.action_cell do %> Labels <% end %> <% end %> <%= table.row do |row| %> <% row.selection_cell do %> G <% end %> <% row.main_cell do %> “California” <% end %> <% row.metadata_cell do %> Labels <% end %> <% end %> <%= table.row do |row| %> <% row.selection_cell do %> V <% end %> <% row.main_cell do %> “New York” <% end %> <% row.metadata_cell do %> Labels <% end %> <% end %> <%= table.row do |row| %> <% row.cell do %> D <% end %> <% row.selection_cell do %> “Texas” <% end %> <% row.metadata_cell do %> Labels <% 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: {}) ⇒ TableNavComponent
<%= render(Ariadne::TableNavComponent.new) do |table| %>
<%= table.header_row do |header_row| %>
<% header_row.selection_cell do %>
Status
<% end %>
<% header_row.main_cell do %>
State
<% end %>
<% header_row.action_cell do %>
Labels
<% end %>
<% end %>
<%= table.row do |row| %>
<% row.selection_cell do %>
G
<% end %>
<% row.main_cell do %>
"California"
<% end %>
<% row.metadata_cell do %>
Labels
<% end %>
<% end %>
<%= table.row do |row| %>
<% row.selection_cell do %>
V
<% end %>
<% row.main_cell do %>
"New York"
<% end %>
<% row.metadata_cell do %>
Labels
<% end %>
<% end %>
<%= table.row do |row| %>
<% row.cell do %>
D
<% end %>
<% row.selection_cell do %>
"Texas"
<% end %>
<% row.metadata_cell do %>
Labels
<% end %>
<% end %>
<% end %>
67 68 69 70 71 72 73 74 75 |
# File 'app/components/ariadne/table_nav_component.rb', line 67 def initialize(classes: "", attributes: {}) @tag = DEFAULT_TAG @classes = class_names( DEFAULT_CLASSES, classes, ) @attributes = attributes end |
Instance Method Details
#has_footer? ⇒ Boolean
81 82 83 |
# File 'app/components/ariadne/table_nav_component.rb', line 81 def .present? end |
#has_header_row? ⇒ Boolean
77 78 79 |
# File 'app/components/ariadne/table_nav_component.rb', line 77 def has_header_row? header_row.present? end |