Fix bug.
This commit is contained in:
parent
4f5fa8ea7d
commit
ae1b7e8f59
|
@ -168,9 +168,19 @@ class CancerpredictsController < ApplicationController
|
|||
tags = OrbitHelper.widget_tags
|
||||
categories = OrbitHelper.widget_categories || []
|
||||
@table_str = File.read('public/cancer_tool_table_tmp_'+I18n.locale.to_s+'.txt')
|
||||
preidct_js_url = '/assets/cancer_predict.js'
|
||||
if File.exist?('public/cancer_tool_js_filename.txt')
|
||||
js_filename = File.read('public/cancer_tool_js_filename.txt')
|
||||
if js_filename.match(/cancer_predict\.js$/)
|
||||
asset = Rails.application.assets[js_filename]
|
||||
preidct_js_url = "#{Rails.application.config.assets.prefix}/#{asset.digest_path}"
|
||||
else
|
||||
preidct_js_url = "#{Rails.application.config.assets.prefix}/#{File.basename(js_filename)}"
|
||||
end
|
||||
end
|
||||
{
|
||||
"cancerpredict" => [],
|
||||
"extras"=>{"table"=> @table_str}
|
||||
"extras"=>{"table"=> @table_str,'preidct_js_url'=>preidct_js_url}
|
||||
}
|
||||
end
|
||||
def create_first_field
|
||||
|
|
|
@ -260,7 +260,7 @@ class Cancerpredictfields
|
|||
stats = env.cached.instance_variable_get(:@stats)
|
||||
new_path = path.sub(/\.erb$/,'')
|
||||
if force_reload || (stats && stats[path]) #Need reload asset
|
||||
if type.nil?
|
||||
if type.nil?
|
||||
ext = File.extname(new_path)
|
||||
env.mime_types.each do |t, h|
|
||||
if h[:extensions].include?(ext)
|
||||
|
@ -286,7 +286,7 @@ class Cancerpredictfields
|
|||
end
|
||||
end
|
||||
def reload_js_asset(path, force_reload=false)
|
||||
reload_any_asset(path, 'application/javascript', force_reload) do |new_path|
|
||||
reload_any_asset(path, 'application/javascript', force_reload) do |new_path|
|
||||
File.open("#{Rails.root}/public/cancer_tool_js_filename.txt",'w+'){|f| f.write(new_path)}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue