Class: Ariadne::UI::TimeAgo::Component

Inherits:
BaseComponent
  • Object
show all
Includes:
FetchOrFallbackHelper
Defined in:
app/components/ariadne/ui/time_ago/component.rb

Overview

Formats a timestamp as a localized string or as relative text that auto-updates in the user’s browser.

Constant Summary collapse

TENSE_DEFAULT =
:auto
TENSE_OPTIONS =
[TENSE_DEFAULT, :past, :future].freeze
FORMAT_DEFAULT =
:auto
FORMAT_OPTIONS =
[FORMAT_DEFAULT, :micro, :elapsed].freeze
FORMAT_STYLE_DEFAULT =
nil
FORMAT_STYLE_OPTIONS =
[FORMAT_STYLE_DEFAULT, :long, :short, :narrow].freeze
SECOND_DEFAULT =
nil
SECOND_MAPPINGS =
{
  SECOND_DEFAULT => nil,
  :numeric => "numeric",
  :two_digit => "2-digit",
}.freeze
SECOND_OPTIONS =
SECOND_MAPPINGS.keys
MINUTE_DEFAULT =
nil
MINUTE_MAPPINGS =
{
  MINUTE_DEFAULT => nil,
  :numeric => "numeric",
  :two_digit => "2-digit",
}.freeze
MINUTE_OPTIONS =
MINUTE_MAPPINGS.keys
HOUR_DEFAULT =
nil
HOUR_MAPPINGS =
{
  HOUR_DEFAULT => nil,
  :numeric => "numeric",
  :two_digit => "2-digit",
}.freeze
HOUR_OPTIONS =
HOUR_MAPPINGS.keys
WEEKDAY_DEFAULT =
nil
WEEKDAY_OPTIONS =
[WEEKDAY_DEFAULT, :long, :short, :narrow].freeze
DAY_DEFAULT =
nil
DAY_MAPPINGS =
{
  DAY_DEFAULT => nil,
  :numeric => "numeric",
  :two_digit => "2-digit",
}.freeze
DAY_OPTIONS =
DAY_MAPPINGS.keys
MONTH_DEFAULT =
nil
MONTH_MAPPINGS =
{
  MONTH_DEFAULT => nil,
  :numeric => "numeric",
  :two_digit => "2-digit",
  :short => "short",
  :long => "long",
  :narrow => "narrow",
}.freeze
MONTH_OPTIONS =
MONTH_MAPPINGS.keys
YEAR_DEFAULT =
nil
YEAR_MAPPINGS =
{
  YEAR_DEFAULT => nil,
  :numeric => "numeric",
  :two_digit => "2-digit",
}.freeze
YEAR_OPTIONS =
YEAR_MAPPINGS.keys
TIMEZONENAME_DEFAULT =
nil
TIMEZONE_MAPPINGS =
{
  TIMEZONENAME_DEFAULT => nil,
  :long => "long",
  :short => "short",
  :short_offset => "shortOffset",
  :long_offset => "longOffset",
  :short_generic => "shortGeneric",
  :long_generic => "longGeneric",
}.freeze
TIMEZONENAME_OPTIONS =
TIMEZONE_MAPPINGS.keys
PRECISION_DEFAULT =
nil
PRECISION_OPTIONS =
[PRECISION_DEFAULT, :second, :minute, :hour, :day, :month, :year].freeze

Constants included from FetchOrFallbackHelper

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

Constants inherited from BaseComponent

BaseComponent::ACCEPT_ANYTHING

Constants included from ViewHelper

ViewHelper::HELPERS

Constants included from AttributesHelper

AttributesHelper::PLURAL_ARIA_ATTRIBUTES, AttributesHelper::PLURAL_DATA_ATTRIBUTES

Method Summary

Methods included from FetchOrFallbackHelper

#check_incoming_attribute, #check_incoming_tag, #check_incoming_value, #fetch_or_fallback, #fetch_or_raise, #fetch_or_raise_boolean, #fetch_or_raise_integer

Methods included from LoggerHelper

#logger, #silence_deprecations?, #silence_warnings?

Methods inherited from BaseComponent

#class_for, #component, component_id, #component_id, component_name, #html_attributes, i18n_scope, #in_turbo_frame, #in_turbo_stream, #options, stimulus_name, #styles, translate, #validate_aria_label!

Methods included from ViewHelper

generate_id

Methods included from AttributesHelper

#aria, #data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes, #prepend_action, #prepend_controller, #prepend_data_attribute

Methods included from ViewComponent::StyleVariants

#merged_styles