Class: WrapItRuby::ProxyController

Inherits:
ApplicationController
  • Object
show all
Includes:
IframeHelper, MenuHelper
Defined in:
app/controllers/wrap_it_ruby/proxy_controller.rb

Instance Method Summary collapse

Methods included from IframeHelper

#iframe_wrapper

Methods included from MenuHelper

#all_menu_items, #all_proxy_menu_items, #menu_config, #proxy_paths, #render_menu, #render_menu_modals, #reset_menu_cache!

Instance Method Details

#showObject



8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/wrap_it_ruby/proxy_controller.rb', line 8

def show
  get_menu_item.then do |menu_item|
    target_path   = request.path.delete_prefix(menu_item["route"])
    target_domain = menu_item["url"]

    target_url  = "#{target_domain}/#{target_path}"
    proxy_host  = ENV["WRAP_IT_PROXY_HOST"]
    @iframe_src = proxy_host ? "//#{proxy_host}/_proxy/#{target_url}" : "/_proxy/#{target_url}"
  end
end