diff options
author | Christoph Helma <helma@in-silico.ch> | 2012-12-11 17:56:02 +0100 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2012-12-11 17:56:02 +0100 |
commit | 9aa2330f4225bffb2afe7128cf47c24f46ad54b0 (patch) | |
tree | a80dce931369b927444c287727f15a449eb92e46 /views | |
parent | 610aaaf543fbc06ed3173011750b48001dc5003c (diff) |
caching version without external proxy
Diffstat (limited to 'views')
-rw-r--r-- | views/compound.haml | 32 | ||||
-rw-r--r-- | views/layout.haml | 6 | ||||
-rw-r--r-- | views/neighbors.haml | 26 | ||||
-rw-r--r-- | views/select.haml | 6 |
4 files changed, 33 insertions, 37 deletions
diff --git a/views/compound.haml b/views/compound.haml index 9509ce0..cea6fe8 100644 --- a/views/compound.haml +++ b/views/compound.haml @@ -1,21 +1,14 @@ :javascript $(document).ready(function() { - /*/ prefetch predictions in order to fill cache in background - $.ajax({ - url: "/cid/#{@compound.cid}/predicted_targets", - cache: true, - dataType: "html" - }); - */ - hide("Measured gene/protein targets",".targets", "/cid/#{@compound.cid}/targets"); - hide("Other active assays",".active_assays", "/cid/#{@compound.cid}/other_active_assays"); - hide("Measured gene/protein non-targets",".nontargets", "/cid/#{@compound.cid}/nontargets"); - hide("Other inactive assays",".inactive_assays", "/cid/#{@compound.cid}/other_inactive_assays"); - hide("Read across gene/protein targets",".predicted_targets", "/cid/#{@compound.cid}/predicted_targets"); - hide("Other active read across assays",".predicted_active_assays", "/cid/#{@compound.cid}/other_predicted_active_assays"); - hide("Read across gene/protein non-targets",".predicted_nontargets", "/cid/#{@compound.cid}/predicted_nontargets"); - hide("Other inactive read across assays",".predicted_inactive_assays", "/cid/#{@compound.cid}/other_predicted_inactive_assays"); - hide("Similar compounds",".neighbors", "/cid/#{@compound.cid}/neighbors"); + hide("Gene/protein targets (experimental)",".targets", "/cid/#{@cid}/targets/active"); + hide("Other active assays (experimental)",".active_assays", "/cid/#{@cid}/assays/active"); + hide("Gene/protein non-targets (experimental)",".nontargets", "/cid/#{@cid}/targets/inactive"); + hide("Other inactive assays (experimental)",".inactive_assays", "/cid/#{@cid}/assays/inactive"); + hide("Gene/protein targets (read across)",".predicted_targets", "/cid/#{@cid}/prediction/targets/active"); + hide("Other active assays (read across)",".predicted_active_assays", "/cid/#{@cid}/prediction/assays/active"); + hide("Gene/protein non-targets (read across)",".predicted_nontargets", "/cid/#{@cid}/prediction/targets/inactive"); + hide("Other inactive assays (read across)",".predicted_inactive_assays", "/cid/#{@cid}/prediction/assays/inactive"); + hide("Similar compounds",".neighbors", "/cid/#{@cid}/neighbors"); }); %table @@ -25,8 +18,11 @@ %col{:width => "37%"} %tr %td{:valign => "top"} - %br= @compound.name - %img{:src => @compound.image_uri} + %br + = name(@cid) + CID: + = @cid + %img{:src => image_uri(@cid)} %td{:valign => "top"} .targets .predicted_targets diff --git a/views/layout.haml b/views/layout.haml index 1abb7a8..19d972a 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -1,10 +1,10 @@ !!! 5 %html %head - %script{:type => "text/javascript", :src => "jquery-1.8.2.js"} + %script{:type => "text/javascript", :src => "/jquery-1.8.2.js"} :javascript function show(title,element,uri) { - $(element).html("<h4>"+title+"</h4>"+"<img src=\"/spinning-wait-icons/wait30trans.gif\" alt=\"Searching PubChem\">"); + $(element).html("<h4>"+title+"</h4>"+"Retrieving data from PubChem. This may take some time, please be patient."+"<img src=\"/spinning-wait-icons/wait30trans.gif\" alt=\"Searching PubChem\">"); $.ajax({ cache: true, url: uri, @@ -24,7 +24,7 @@ } function display(element,uri) { - $(element).html("<img src=\"/spinning-wait-icons/wait30trans.gif\" alt=\"Searching PubChem\">"); + $(element).html("Retrieving data from PubChem. This may take some time, please be patient."+"<img src=\"/spinning-wait-icons/wait30trans.gif\" alt=\"Searching PubChem\">"); $.ajax({ cache: true, url: uri, diff --git a/views/neighbors.haml b/views/neighbors.haml index 09dc6cf..526f2bb 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -5,29 +5,29 @@ %col{:width => "37%"} - idx = 0 - while idx < 10 - - @compound.neighbors.each do |n| - - unless n.assays.empty? + - neighbors(@cid).each do |n| + - unless assays(n,"active").empty? and assays(n,"inactive").empty? %tr %td{:valign => "top"} %br - = n.name + = name n ( - = @compound.cosine(n).round(3) + = similarity(@cid,n).round(3) ) - %img{:src => n.image_uri} + %img{:src => image_uri(n)} %td{:valign => "top"} - %p{:id => "targets#{n.cid}"} + %p{:id => "targets#{n}"} :javascript - hide("Measured gene/protein targets","#targets#{n.cid}", "/cid/#{n.cid}/targets"); - %p{:id => "nontargets#{n.cid}"} + hide("Measured gene/protein targets","#targets#{n}", "/cid/#{n}/targets/active"); + %p{:id => "nontargets#{n}"} :javascript - hide("Measured gene/protein non-targets","#nontargets#{n.cid}", "/cid/#{n.cid}/nontargets"); + hide("Measured gene/protein non-targets","#nontargets#{n}", "/cid/#{n}/targets/inactive"); %td{:valign => "top"} - %p{:id => "assays#{n.cid}"} + %p{:id => "assays#{n}"} :javascript - hide("Other active assays","#assays#{n.cid}", "/cid/#{n.cid}/other_active_assays"); - %p{:id => "inactive_assays#{n.cid}"} + hide("Other active assays","#assays#{n}", "/cid/#{n}/assays/active"); + %p{:id => "inactive_assays#{n}"} :javascript - hide("Other inactive assays","#inactive_assays#{n.cid}", "/cid/#{n.cid}/other_inactive_assays"); + hide("Other inactive assays","#inactive_assays#{n}", "/cid/#{n}/assays/inactive"); - idx += 1 diff --git a/views/select.haml b/views/select.haml index d6e3d20..1dd8cf4 100644 --- a/views/select.haml +++ b/views/select.haml @@ -2,7 +2,7 @@ More than one compound found for = "\"#{params[:name]}\"." Please select a structure: -- @compounds.each do |compound| - %a{:href => "/cid/#{compound.cid}"} - %img{:src => compound.image_uri } +- @cids.each do |cid| + %a{:href => "/cid/#{cid}"} + %img{:src => image_uri(cid)} |