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
Feedback::Component, Orders::Index::Component, Products::Index::Component, Products::Show::Component, Products::Status::Component, Sidebar::AccountNav::Component, Sidebar::Component, Sidebar::Item::Component, SkipLink::Component, UI::Badge::Component, UI::Button::Component, UI::Forms::Checkbox::Component, UI::Forms::Field::Component, UI::Forms::Input::Component, UI::Forms::Switch::Component, UI::Icon::Component, UI::Panel::Component, UI::Tab::Component, UI::Table::Component, UI::Table::Pagination::Component, UI::Toast::Component, UI::Toggletip::Component
Class Method Summary
collapse
Instance Method Summary
collapse
#component
Class Method Details
.stimulus_id ⇒ Object
25
26
27
28
29
30
|
# File 'app/components/solidus_admin/base_component.rb', line 25
def self.stimulus_id
@stimulus_id ||= name.underscore
.sub(/^solidus_admin\/(.*)\/component$/, '\1')
.gsub("/", "--")
.tr("_", "-")
end
|
Instance Method Details
#icon_tag(name, **attrs) ⇒ Object
9
10
11
|
# File 'app/components/solidus_admin/base_component.rb', line 9
def icon_tag(name, **attrs)
render component("ui/icon").new(name: name, **attrs)
end
|
#missing_translation(key, options) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
|
# File 'app/components/solidus_admin/base_component.rb', line 13
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] != :en
t(key, **options, locale: :en)
else
"translation missing: #{keys.join('.')}"
end
end
|
#solidus_admin ⇒ Object
38
39
40
|
# File 'app/components/solidus_admin/base_component.rb', line 38
def solidus_admin
@solidus_admin ||= SolidusAdmin::Engine.routes.url_helpers
end
|
#spree ⇒ Object
34
35
36
|
# File 'app/components/solidus_admin/base_component.rb', line 34
def spree
@spree ||= Spree::Core::Engine.routes.url_helpers
end
|