diff options
author | gebele <gebele@in-silico.ch> | 2018-05-29 14:09:03 +0000 |
---|---|---|
committer | gebele <gebele@in-silico.ch> | 2018-05-29 14:09:03 +0000 |
commit | b5b45bde028ceb3e9d2dac8ad7f14912978000a7 (patch) | |
tree | 443bc9499ce01aaca1fb7a980d5a9a8c97fd8952 /application.rb | |
parent | 82f8396b1e2fcf72e584ea746c4d4c675b95284f (diff) |
add license, faq and qmrfbatch
Diffstat (limited to 'application.rb')
-rw-r--r-- | application.rb | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/application.rb b/application.rb index bd2ae54..7b99d22 100644 --- a/application.rb +++ b/application.rb @@ -1,7 +1,6 @@ [ 'batch.rb', 'helper.rb', - 'login.rb', 'prediction.rb', 'qmrf_report.rb', 'task.rb' @@ -11,20 +10,20 @@ end include OpenTox -use Rack::Auth::Basic, "Please enter your login credentials." do |username, password| - [username, password] == [$user, $pass] -end +#use Rack::Auth::Basic, "Please enter your login credentials." do |username, password| +# [username, password] == [$user, $pass] +#end configure :development, :production do $logger = Logger.new(STDOUT) - enable :reloader - [ - 'batch.rb', - 'helper.rb', - 'prediction.rb' - ].each do |lib| - also_reload lib - end + #enable :reloader + #[ + # 'batch.rb', + # 'helper.rb', + # 'prediction.rb' + #].each do |lib| + # also_reload lib + #end end before do @@ -383,6 +382,28 @@ post '/predict/?' do end end +get "/report/:id/?" do + prediction_model = Model::Validation.find params[:id] + bad_request_error "model with id: '#{params[:id]}' not found." unless prediction_model + report = qmrf_report params[:id] + # output + t = Tempfile.new + t << report.to_xml + name = prediction_model.species.sub(/\s/,"-")+"-"+prediction_model.endpoint.downcase.sub(/\s/,"-") + send_file t.path, :filename => "QMRF_report_#{name.gsub!(/[^0-9A-Za-z]/, '_')}.xml", :type => "application/xml", :disposition => "attachment" +end + +get '/license' do + @license = RDiscount.new(File.read("LICENSE.md")).to_html + haml :license, :layout => false +end + +get '/faq' do + @faq = RDiscount.new(File.read("FAQ.md")).to_html + haml :faq, :layout => false +end + + get '/style.css' do headers 'Content-Type' => 'text/css; charset=utf-8' scss :style |