From b5b45bde028ceb3e9d2dac8ad7f14912978000a7 Mon Sep 17 00:00:00 2001 From: gebele Date: Tue, 29 May 2018 14:09:03 +0000 Subject: add license, faq and qmrf --- application.rb | 45 +++++++++++++++++++++++++++++++++------------ views/faq.haml | 2 ++ views/license.haml | 1 + 3 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 views/faq.haml create mode 100644 views/license.haml 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 diff --git a/views/faq.haml b/views/faq.haml new file mode 100644 index 0000000..818b96a --- /dev/null +++ b/views/faq.haml @@ -0,0 +1,2 @@ +%div.well.faq + = @faq diff --git a/views/license.haml b/views/license.haml new file mode 100644 index 0000000..2813220 --- /dev/null +++ b/views/license.haml @@ -0,0 +1 @@ += @license -- cgit v1.2.3