From dfffcd555607ce21645eb481bb151c7873c367ab Mon Sep 17 00:00:00 2001 From: gebele Date: Fri, 22 Jan 2016 13:49:16 +0100 Subject: initial commit hard copied nanoparticles.rb and data.json from @helma nano-lazar --- views/layout.haml | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++ views/predict.haml | 18 +++++++++++++++ views/prediction.haml | 54 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 135 insertions(+) create mode 100644 views/layout.haml create mode 100644 views/predict.haml create mode 100644 views/prediction.haml (limited to 'views') diff --git a/views/layout.haml b/views/layout.haml new file mode 100644 index 0000000..d6b1a9e --- /dev/null +++ b/views/layout.haml @@ -0,0 +1,63 @@ +!!! +%html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en", :lang => "en"} + %head + %meta{'charset'=>"utf-8"} + %meta{'http-equiv'=>"X-UA-Compatible", :content=>"IE=edge"} + %meta{'name'=>"viewport", :content=>"width=device-width, initial-scale=1"} + %title Nano Lazar Toxicity Predictions + %link{:rel=>'icon', :type=>'image/x-icon', :href=>'/images/favicon.ico'} + %link{:rel=>'stylesheet', :href=>"#{'/css/bootstrap.min.css'}"} + %link{:rel=>'stylesheet', :href=>"#{'/css/theme.default.min.css'}"} + %link{:rel=>'stylesheet', :href=>"#{'/css/theme.bootstrap.min.css'}"} + %script{:src=>"/javascripts/jquery-1.11.2.min.js"} + %script{:src=>"/javascripts/bootstrap.min.js"} + %body + %noscript + %div{ :style=>"width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif"} + Your web browser must have JavaScript enabled in order for this application to display correctly. + %header.page-header + %div.row + %div.col-md-2 + %a{:href=> to("/predict")} + %img.media-object{:src=>"/images/ist_logo.png", :alt=>"logo_ist", :style=>"margin:0 3em 0 2em;"} + %div.col-md-6 + %h1.media-heading{:style=>"margin: 0 0 0 1em;"} Nano Lazar Toxicity Predictions + %div.col-md-2 + %a{:href=> "http://www.enanomapper.net" } + %img.media-object{:src=>"/images/enm-sm.jpg", :width=>"200px", :heigth=>"200px", :alt=>"logo_enm", :style=>"margin:0 3em 0 2em;"} + + %div.container-fluid + :javascript + $(document).ready(function(){ + $("#back-top").hide(); + }); + + = yield + + %footer.footer + %div.container-fluid + %p.text-muted + © + %a{:href => 'http://www.in-silico.ch', :rel => "external"} in silico toxicology gmbh 2004 - #{Time.now.year.to_s} + + #back-top{:style => "z-index:100;position:fixed;bottom:1%;right:1%;"} + %a{:href => "", :style=>"text:decoration:none;color:#ccc;"} + %span.glyphicon.glyphicon-circle-arrow-up{:style => "font-size:3em;color:black;"} + :javascript + $("#back-top").hide(); + $(function () { + $(window).scroll(function () { + if ($(this).scrollTop() > 600) { + $('#back-top').fadeIn(); + } else { + $('#back-top').fadeOut(); + } + }); + // scroll body to 0px on click + $('#back-top a').click(function () { + $('body,html').animate({ + scrollTop: 0 + }, 500); + return false; + }); + }); diff --git a/views/predict.haml b/views/predict.haml new file mode 100644 index 0000000..6b9bf95 --- /dev/null +++ b/views/predict.haml @@ -0,0 +1,18 @@ +%div.well + %form{:role=>"form", :action=> to("/predict"), :method=>"post"} + %span.help-block + some help text to explain + #input + - size = @example.size + - @example.each_with_index do |v,id| + - id = id + 1 + - key = v[0] + - val = v[1] + %div.form-group + %h3= key + %input.form-control{:id=>id,:type=>"hidden",:name=>"input_key_#{id}",:value=>key} + %input.form-control{:id=>id,:type=>"text",:name=>"input_value_#{id}",:value=>val} + %input.form-control{:id=>"example",:type=>"hidden",:name=>"size",:value=>size} + %hr + #predict + %button.btn.btn-info{:type=>"submit"} predict diff --git a/views/prediction.haml b/views/prediction.haml new file mode 100644 index 0000000..75164bd --- /dev/null +++ b/views/prediction.haml @@ -0,0 +1,54 @@ +%div.well + %ul.nav.nav-tabs + %li + %a{:href=>"#query", :data=>{:toggle=>"tab"}} Query + %li + %a{:href=>"#match", :data=>{:toggle=>"tab"}} Match + %li.active + %a{:href=>"#prediction", :data=>{:toggle=>"tab"}} Prediction + %li + %a{:href=>"#neighbors", :data=>{:toggle=>"tab"}} Neighbors + + %div.tab-content + #query.tab-pane.fade + %span.help-block + your query was + - @input.each_with_index do |v,id| + - key = v[0] + - val = v[1] + %h3= key + %input.form-control{:id=>id,:type=>"text",:value=>"#{val}", :disabled=>"true"} + #match.tab-pane.fade + - if @prediction[:match] + %table + - @prediction[:match][:id].keys.each do |key| + %tr + %h3= key.capitalize + - @prediction[:match][:id][key.to_s].each do |k,v| + %td + %h5= k + %p= v + - else + %h3 No match + #prediction.tab-pane.in.active + - @prediction[:prediction].each do |k,v| + %h3= k + %p= v + #neighbors.tab-pane.fade + - @prediction[:neighbors].each do |neighbor| + %h3= neighbor["id"] + %h5= "Similarity: #{neighbor["similarity"]}" + %h3 Composition + - neighbor["composition"].each do |k,v| + %h5= k + %p= v + %h3 Tox + - neighbor["tox"].each do |k,v| + %h5= k + %p= v + %h3 Physchem + - neighbor["physchem"].each do |k,v| + %h5= k + %p= v + %hr + -- cgit v1.2.3