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

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

Constant Summary collapse

RE_GOOGLE_FOLDER =
%r{/drive/(.*/)?folders/}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.document_path(*args) ⇒ Object



29
30
31
# File 'app/controllers/lcms/engine/admin/admin_controller.rb', line 29

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

.engine_klassObject



25
26
27
# File 'app/controllers/lcms/engine/admin/admin_controller.rb', line 25

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

.host_engine_path(key, *args) ⇒ Object



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

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



33
34
35
# File 'app/controllers/lcms/engine/admin/admin_controller.rb', line 33

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

.root_pathObject



37
38
39
# File 'app/controllers/lcms/engine/admin/admin_controller.rb', line 37

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

.settingsObject



21
22
23
# File 'app/controllers/lcms/engine/admin/admin_controller.rb', line 21

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

Instance Method Details

#whoamiObject



56
57
58
# File 'app/controllers/lcms/engine/admin/admin_controller.rb', line 56

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