summaryrefslogtreecommitdiff
path: root/views/neighbors_navigation.haml
blob: 074b62c3723ffc18096deee0a4b648caa0f26239 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
.neighbors_navigation

  %form{:name => "nav", :action => url_for('/lazar#prediction'), :method => "post", :enctype => "multipart/form-data", :id => "nav"}
    %input{:type => :hidden, :name => :compound_uri, :value => @compound.uri}
    %input{:type => :hidden, :name => :model_uri, :value => @model_uri}
    %input{:type => :hidden, :name => :subjectid, :value => session[:subjectid]}    
    %input{:type => :hidden, :name => :page, :id => "page"}

    #prev= "prev" unless @page.to_i == 0

    - if @prediction.neighbors(@compound).size < 5*@page+5
      - last = @prediction.neighbors(@compound).size 
    - else 
      - last = 5*@page+5

    = "(#{5*@page+1}-#{last}/#{@prediction.neighbors(@compound).size})" 

    #next= "next" unless 5*@page.to_i+5 >= @prediction.neighbors(@compound).size

    :javascript
      $("#prev").click(function() {
        $("#page").val(#{@page-1});
        $("#nav").submit();
      });
      $("#next").click(function() {
        $("#page").val(#{@page+1});
        $("#nav").submit();
      });