Class: SolidusAdmin::BaseComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- SolidusAdmin::BaseComponent
show all
- Includes:
- ComponentsHelper, Turbo::FramesHelper
- Defined in:
- app/components/solidus_admin/base_component.rb
Overview
BaseComponent is the base class for all components in Solidus Admin.
Direct Known Subclasses
AdjustmentReasons::Edit::Component, AdjustmentReasons::New::Component, Layout::Feedback::Component, Layout::Navigation::Account::Component, Layout::Navigation::Component, Layout::Navigation::Item::Component, Layout::SkipLink::Component, Orders::Cart::Component, Orders::Cart::Result::Component, Orders::Show::Address::Component, Orders::Show::Adjustments::Index::Adjustable::Component, Orders::Show::Adjustments::Index::Source::Component, Orders::Show::Component, Orders::Show::CustomerSearch::Component, Orders::Show::CustomerSearch::Result::Component, Orders::Show::Email::Component, Orders::Show::Summary::Component, Products::Show::Component, Products::Status::Component, Products::Stock::Component, RefundReasons::Edit::Component, RefundReasons::New::Component, ReturnReasons::Edit::Component, ReturnReasons::New::Component, Roles::Edit::Component, Roles::New::Component, StockItems::Edit::Component, StoreCreditReasons::Edit::Component, StoreCreditReasons::New::Component, UI::Badge::Component, UI::Button::Component, UI::CheckboxRow::Component, UI::DetailsList::Component, UI::Dropdown::Component, UI::Forms::Address::Component, UI::Forms::Checkbox::Component, UI::Forms::Field::Component, UI::Forms::Input::Component, UI::Forms::Search::Component, UI::Forms::Search::Result::Component, UI::Forms::SearchField::Component, UI::Forms::Switch::Component, UI::Forms::SwitchField::Component, UI::Icon::Component, UI::Modal::Component, UI::Pages::Index::Component, UI::Panel::Component, UI::ResourceItem::Component, UI::Tab::Component, UI::Table::Component, UI::Table::Pagination::Component, UI::Table::RansackFilter::Component, UI::Table::Toolbar::Component, UI::Thumbnail::Component, UI::ThumbnailWithCaption::Component, UI::Toast::Component, UI::Toggletip::Component, Users::Addresses::Component, Users::Edit::ApiAccess::Component, Users::Edit::Component, Users::Items::Component, Users::Orders::Component, Users::Stats::Component, Users::StoreCredits::Index::Component
Class Method Summary
collapse
Instance Method Summary
collapse
#component
Class Method Details
.i18n_scope ⇒ Object
28
29
30
|
# File 'app/components/solidus_admin/base_component.rb', line 28
def self.i18n_scope
@i18n_scope ||= name.underscore.tr("/", ".")
end
|
.stimulus_id ⇒ Object
32
33
34
35
36
37
|
# File 'app/components/solidus_admin/base_component.rb', line 32
def self.stimulus_id
@stimulus_id ||= name.underscore
.sub(/^solidus_admin\/(.*)\/component$/, '\1')
.gsub("/", "--")
.tr("_", "-")
end
|
Instance Method Details
#icon_tag(name, **attrs) ⇒ Object
12
13
14
|
# File 'app/components/solidus_admin/base_component.rb', line 12
def icon_tag(name, **attrs)
render component("ui/icon").new(name:, **attrs)
end
|
#missing_translation(key, options) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/components/solidus_admin/base_component.rb', line 16
def missing_translation(key, options)
keys = I18n.normalize_keys(options[:locale] || I18n.locale, key, options[:scope])
logger.debug " [#{self.class}] Missing translation: #{keys.join('.')}"
if (options[:locale] || I18n.default_locale) != :en
t(key, **options, locale: :en)
else
"translation missing: #{keys.join('.')}"
end
end
|