Class: Ariadne::TableNavComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/ariadne/table_nav_component.rb

Overview

The TableNavComponent is used to render a table navigation.

Direct Known Subclasses

BaseCellItem, BaseRowItem, FooterItem

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

Status::Dsl::STATUSES

Constants included from ViewHelper

ViewHelper::HELPERS

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::INTEGER_TYPES, FetchOrFallbackHelper::InvalidValueError, FetchOrFallbackHelper::TRUE_OR_FALSE

Instance Method Summary collapse

Methods included from ActionViewExtensions::FormHelper

#ariadne_form_with

Methods included from ClassNameHelper

#class_names

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 %>

Examples:

Default


Parameters:

  • classes (String) (defaults to: "")

    <%= link_to_classes_docs %>

  • attributes (Hash) (defaults to: {})

    <%= link_to_attributes_docs %>



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

Returns:

  • (Boolean)


81
82
83
# File 'app/components/ariadne/table_nav_component.rb', line 81

def has_footer?
  footer.present?
end

#has_header_row?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'app/components/ariadne/table_nav_component.rb', line 77

def has_header_row?
  header_row.present?
end