summaryrefslogtreecommitdiff
path: root/views/prediction.haml
diff options
context:
space:
mode:
Diffstat (limited to 'views/prediction.haml')
-rw-r--r--views/prediction.haml117
1 files changed, 89 insertions, 28 deletions
diff --git a/views/prediction.haml b/views/prediction.haml
index 75164bd..99bd2a0 100644
--- a/views/prediction.haml
+++ b/views/prediction.haml
@@ -1,4 +1,7 @@
%div.well
+ %a.btn.btn-xs.btn-warning{:href => to('/predict'), :style=>"margin-bottom:1em;"}
+ %i.glyphicon.glyphicon-menu-left
+ New Prediction
%ul.nav.nav-tabs
%li
%a{:href=>"#query", :data=>{:toggle=>"tab"}} Query
@@ -16,39 +19,97 @@
- @input.each_with_index do |v,id|
- key = v[0]
- val = v[1]
- %h3= key
+ %h5= 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
+ %table{:id=>"match"}
+ %thead
+ %tr
+ - @prediction[:match][:id].keys.each do |key|
+ %th= key.capitalize
+ %tbody
+ %tr
+ / composition
+ %td
+ - @prediction[:match][:id]["composition"].each do |k,v|
+ %h5= k
+ %p= v
+ / tox
+ %td
+ - @prediction[:match][:id]["tox"].each do |k,v|
+ %h5= k
+ %p= v
+ / physchem
+ %td
+ - @prediction[:match][:id]["physchem"].each do |k,v|
+ %h5= k
+ %p= v
- else
- %h3 No match
+ %h5 No match
#prediction.tab-pane.in.active
- @prediction[:prediction].each do |k,v|
- %h3= k
- %p= v
+ %h5= k
+ %p= v.round(5)
#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
+ :javascript
+ $(document).ready(function(){
+ $("table#match").tablesorter({
+ debug: false,
+ theme: "bootstrap",
+ headerTemplate: '{content} {icon}',
+ widgets: ['uitheme'],
+ headers: {0: {sorter: false}, 1: {sorter: false}, 2: {sorter: false}},
+ sortList: [[1,1]],
+ widthFixed: false
+ });
+ });
+ $(document).ready(function(){
+ $("table#neighbors").tablesorter({
+ debug: false,
+ theme: "bootstrap",
+ headerTemplate: '{content} {icon}',
+ widgets: ['uitheme'],
+ sortList: [[1,1]],
+ widthFixed: false
+ });
+ });
+ %div.table-responsive
+ %table.tablesorter{:id=>"neighbors", :style=>"border-style: 1px solid black;margin-top:10px;"}
+ %thead
+ %tr
+ %th{:style =>"vertical-align:middle;"}
+ ID
+ %th{:style =>"vertical-align:middle;"}
+ Similarity
+ %th{:style =>"vertical-align:middle;"}
+ Composition
+ %th{:style =>"vertical-align:middle;"}
+ Tox
+ %th{:style =>"vertical-align:middle;"}
+ Physchem
+ %tbody
+ - @prediction[:neighbors].each do |neighbor|
+ %tr
+ / ID
+ %td
+ %h5= neighbor["id"]
+ / Similarity
+ %td
+ %h5= neighbor["similarity"].round(3)
+ / Composition
+ %td
+ - neighbor["composition"].each do |k,v|
+ %h5= k
+ %p= v
+ / Tox
+ %td
+ - neighbor["tox"].each do |k,v|
+ %h5= k
+ %p= v.round(3)
+ / Physchem
+ %td
+ - neighbor["physchem"].each do |k,v|
+ %h5= k
+ %p= v