Class: Lcms::Engine::Admin::AdminController

Inherits:
Lcms::Engine::ApplicationController show all
Defined in:
app/controllers/lcms/engine/admin/admin_controller.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.document_path(*args) ⇒ Object



27
28
29
# File 'app/controllers/lcms/engine/admin/admin_controller.rb', line 27

def document_path(*args)
  host_engine_path(:document_path, *args).presence || url_helpers.document_path(*args)
end

.engine_klassObject



23
24
25
# File 'app/controllers/lcms/engine/admin/admin_controller.rb', line 23

def engine_klass
  @engine_klass ||= settings[:engine]&.constantize || ::Lcms::Engine::Engine
end

.host_engine_path(key, *args) ⇒ Object



39
40
41
42
43
44
45
# File 'app/controllers/lcms/engine/admin/admin_controller.rb', line 39

def host_engine_path(key, *args)
  if (host_route = settings.dig(:redirect, :host, key)).present?
    Rails.application.routes.url_helpers.send(host_route, *args)
  elsif (engine_route = settings.dig(:redirect, :engine, key)).present?
    engine_klass.routes.url_helpers.send(engine_route, *args)
  end
end

.material_path(*args) ⇒ Object



31
32
33
# File 'app/controllers/lcms/engine/admin/admin_controller.rb', line 31

def material_path(*args)
  host_engine_path(:material_path, *args).presence || url_helpers.material_path(*args)
end

.root_pathObject



35
36
37
# File 'app/controllers/lcms/engine/admin/admin_controller.rb', line 35

def root_path
  host_engine_path(:root_path).presence || url_helpers.root_path
end

.settingsObject



19
20
21
# File 'app/controllers/lcms/engine/admin/admin_controller.rb', line 19

def settings
  @settings ||= DEFAULTS.merge((YAML.load_file(CONFIG_PATH) || {}).deep_symbolize_keys)
end

Instance Method Details

#whoamiObject



54
55
56
# File 'app/controllers/lcms/engine/admin/admin_controller.rb', line 54

def whoami
  render text: "stack=#{ENV['CLOUD66_STACK_NAME']}<br/>env=#{ENV['CLOUD66_STACK_ENVIRONMENT']}"
end