summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2018-05-29 14:09:03 +0000
committergebele <gebele@in-silico.ch>2018-05-29 14:09:03 +0000
commitb5b45bde028ceb3e9d2dac8ad7f14912978000a7 (patch)
tree443bc9499ce01aaca1fb7a980d5a9a8c97fd8952
parent82f8396b1e2fcf72e584ea746c4d4c675b95284f (diff)
add license, faq and qmrfbatch
-rw-r--r--application.rb45
-rw-r--r--views/faq.haml2
-rw-r--r--views/license.haml1
3 files changed, 36 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
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