Sha256: 2fb7554342ee5743e389afd4f4f7d775453dbc8817fb2e14f3a81da77bf15ce4
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module SolidusAdmin # BaseComponent is the base class for all components in Solidus Admin. class BaseComponent < ViewComponent::Base include SolidusAdmin::ComponentsHelper include Turbo::FramesHelper def icon_tag(name, **attrs) render component("ui/icon").new(name: name, **attrs) end 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 def self.stimulus_id @stimulus_id ||= name.underscore .sub(/^solidus_admin\/(.*)\/component$/, '\1') .gsub("/", "--") .tr("_", "-") end delegate :stimulus_id, to: :class def spree @spree ||= Spree::Core::Engine.routes.url_helpers end def solidus_admin @solidus_admin ||= SolidusAdmin::Engine.routes.url_helpers end end end
Version data entries
3 entries across 3 versions & 1 rubygems