Class: SolidusAdmin::BaseComponent

Inherits:
ViewComponent::Base
  • Object
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::Index::Component, Layout::Feedback::Component, Layout::Navigation::Account::Component, Layout::Navigation::Component, Layout::Navigation::Item::Component, Layout::SkipLink::Component, OptionTypes::Index::Component, Orders::Cart::Component, Orders::Cart::Result::Component, Orders::Index::Component, Orders::Show::Address::Component, Orders::Show::Component, Orders::Show::CustomerSearch::Component, Orders::Show::CustomerSearch::Result::Component, Orders::Show::Email::Component, Orders::Show::Summary::Component, PaymentMethods::Index::Component, Products::Index::Component, Products::Show::Component, Products::Status::Component, Products::Stock::Component, PromotionCategories::Index::Component, Promotions::Index::Component, Properties::Index::Component, RefundReasons::Index::Component, RefundsAndReturns::Component, ReimbursementTypes::Index::Component, ReturnReasons::Index::Component, Shipping::Component, ShippingCategories::Index::Component, ShippingMethods::Index::Component, StockItems::Edit::Component, StockItems::Index::Component, StockLocations::Index::Component, StoreCreditReasons::Index::Component, Stores::Index::Component, TaxCategories::Index::Component, TaxRates::Index::Component, Taxes::Component, Taxonomies::Index::Component, UI::Badge::Component, UI::Button::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::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::Toast::Component, UI::Toggletip::Component, Users::Index::Component, Zones::Index::Component

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ComponentsHelper

#component

Class Method Details

.stimulus_idObject



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_adminObject



38
39
40
# File 'app/components/solidus_admin/base_component.rb', line 38

def solidus_admin
  @solidus_admin ||= SolidusAdmin::Engine.routes.url_helpers
end

#spreeObject



34
35
36
# File 'app/components/solidus_admin/base_component.rb', line 34

def spree
  @spree ||= Spree::Core::Engine.routes.url_helpers
end