From 88ac5fbe3d8d3141fbad81460b13d6cb8284da26 Mon Sep 17 00:00:00 2001 From: gebele Date: Fri, 22 Jan 2016 23:18:56 +0100 Subject: refined prediction --- views/predict.haml | 2 +- views/prediction.haml | 147 +++++++++++++++++++++++++++----------------------- 2 files changed, 80 insertions(+), 69 deletions(-) (limited to 'views') diff --git a/views/predict.haml b/views/predict.haml index 6abd5bc..4584cbf 100644 --- a/views/predict.haml +++ b/views/predict.haml @@ -1,6 +1,6 @@ %div.well %form{:role=>"form", :action=> to("/predict"), :method=>"post"} - %span.help-block + %h3.help-block Please characterise a Gold nanoparticle #input - size = @example.size diff --git a/views/prediction.haml b/views/prediction.haml index 99bd2a0..113e934 100644 --- a/views/prediction.haml +++ b/views/prediction.haml @@ -22,94 +22,105 @@ %h5= key %input.form-control{:id=>id,:type=>"text",:value=>"#{val}", :disabled=>"true"} #match.tab-pane.fade - - if @prediction[:match] - %table{:id=>"match"} + - if @prediction[:match] + %table{:id=>"match", :style=>"border-style: 1px solid black;margin-top:10px;"} %thead %tr - - @prediction[:match][:id].keys.each do |key| - %th= key.capitalize + %th + ID + %th + Composition + %th + Tox + %th + Physchem %tbody %tr + / ID + %td + %h5= @prediction[:match].keys[0] / composition %td - - @prediction[:match][:id]["composition"].each do |k,v| + - @prediction[:match].values[0]["composition"].each do |k,v| %h5= k %p= v / tox %td - - @prediction[:match][:id]["tox"].each do |k,v| + - @prediction[:match].values[0]["tox"].each do |k,v| %h5= k %p= v / physchem %td - - @prediction[:match][:id]["physchem"].each do |k,v| + - @prediction[:match].values[0]["physchem"].each do |k,v| %h5= k %p= v - else %h5 No match #prediction.tab-pane.in.active - - @prediction[:prediction].each do |k,v| - %h5= k - %p= v.round(5) + - if @prediction[:prediction] + - @prediction[:prediction].each do |k,v| + %h5= k + %p= v.round(5) #neighbors.tab-pane.fade - :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 + - if @prediction[:neighbors] + :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}, 3: {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 + $(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 + %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 -- cgit v1.2.3