Better debug info if possible
This commit is contained in:
@@ -9,22 +9,22 @@ module Dunlop
|
||||
app_globals = {}
|
||||
if adapter_name = params[:adapter].to_s.scan(/\w+/).first.presence
|
||||
return render html: '403 - unauthorized, no adapter engine', status: 403 unless adapter = Panda.adapters[adapter_name]
|
||||
app_index = Rails.root.join("public/adapters/#{adapter.url_name}/app/index.html")
|
||||
@app_index = Rails.root.join("public/adapters/#{adapter.url_name}/app/index.html")
|
||||
#app_globals = adapter.settings # load through request instead. More stable then changing environments
|
||||
unless Rails.application.config.try(:loose_ember_app_authorization)
|
||||
return render html: '403 - unauthorized, no adapter engine permission', status: 403 unless current_user.admin? or can?(:read, adapter.engine)
|
||||
end
|
||||
else
|
||||
app_index = Rails.root.join('public/app/index.html')
|
||||
@app_index = Rails.root.join('public/app/index.html')
|
||||
end
|
||||
Rails.logger.info "Loading ember app for path '#/#{params[:rest]}' adapter: '#{params[:adapter].presence || 'main_app'}'"
|
||||
if app_index.exist?
|
||||
index_html = app_index.read.to_s
|
||||
if @app_index.exist?
|
||||
index_html = @app_index.read.to_s
|
||||
app_globals[:flash] = flash.to_h if flash.present?
|
||||
index_html.sub! 'app_globals={}', "app_globals=#{app_globals.to_json}" if app_globals.present?
|
||||
render html: index_html.html_safe
|
||||
else
|
||||
render html: "App file <tt>#{app_index}</tt> not found".html_safe
|
||||
render html: "App file <tt>#{@app_index.to_s}</tt> not found".html_safe
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
h3
|
||||
span Could not find
|
||||
tt= '/app/index.html'
|
||||
tt= @app_index || '/app/index.html'
|
||||
span file
|
||||
|
||||
Reference in New Issue
Block a user