Class: SolidusAdmin::Resources::BaseComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/solidus_admin/resources/base_component.rb

Direct Known Subclasses

Edit::Component, New::Component

Constant Summary

Constants included from VoidElementsHelper

VoidElementsHelper::HTML_VOID_ELEMENTS

Instance Method Summary collapse

Methods inherited from BaseComponent

i18n_scope, #icon_tag, #missing_translation, stimulus_id

Methods included from VoidElementsHelper

#void_element?

Methods included from ComponentsHelper

#component

Constructor Details

#initialize(resource) ⇒ BaseComponent

Returns a new instance of BaseComponent.



4
5
6
7
# File 'app/components/solidus_admin/resources/base_component.rb', line 4

def initialize(resource)
  @resource = resource
  instance_variable_set("@#{resource_name}", resource)
end

Instance Method Details

#back_urlObject



9
10
11
# File 'app/components/solidus_admin/resources/base_component.rb', line 9

def back_url
  solidus_admin.send("#{plural_resource_name}_path")
end

#plural_resource_nameObject



17
18
19
# File 'app/components/solidus_admin/resources/base_component.rb', line 17

def plural_resource_name
  @resource.model_name.route_key
end

#resource_nameObject



13
14
15
# File 'app/components/solidus_admin/resources/base_component.rb', line 13

def resource_name
  @resource.model_name.singular_route_key
end