summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authormr <mr@mrautenberg.de>2011-10-19 13:11:24 +0200
committermr <mr@mrautenberg.de>2011-10-19 13:11:24 +0200
commitd89c87e844e81d016ab3ba8a240e03a609a7015e (patch)
tree6d5323fee132cfdaa492f9844704a9f855ff2635 /views
parent778c58cad1c6a5b81655d731992c64a0efcec592 (diff)
parentf53928a35754c29f7ee912ed5f405731d451f49e (diff)
Merge branch 'release/v3.0.1'v3.0.1
Diffstat (limited to 'views')
-rw-r--r--views/create.haml30
-rw-r--r--views/create_echa.haml2
-rw-r--r--views/model.haml3
-rw-r--r--views/model_echa.haml2
-rw-r--r--views/models.haml1
-rw-r--r--views/models_navigation.haml46
-rw-r--r--views/models_navigation_bottom.haml42
-rw-r--r--views/neighbors.haml2
-rw-r--r--views/predict.haml5
-rw-r--r--views/style.sass64
10 files changed, 163 insertions, 34 deletions
diff --git a/views/create.haml b/views/create.haml
index da85382..9b0ca09 100644
--- a/views/create.haml
+++ b/views/create.haml
@@ -1,3 +1,30 @@
+:javascript
+ $(document).ready(function() {
+ $(".endpoint_list").click(function() {
+ elem = this.id;
+ title = $("label#label_" + elem).html();
+ if($("ul#list_" + elem)) {
+ if ($("ul#list_" + elem).is(":hidden")) {
+ $("ul#list_" + elem).slideDown("slow");
+ } else {
+ $("ul#list_" + elem).slideUp("slow");
+ }
+ }
+ $("span#endpoint_label").html(title);
+ });
+ $("#endpoint_list_button").click(function() {
+ if ($("div#div_endpoint").is(":hidden")) {
+ $("div#div_endpoint").slideDown("slow");
+ $("input#endpoint_list_button").val("Hide");
+ $("input#endpoint_list_button").toggleClass("ok_button", true);
+ } else {
+ $("div#div_endpoint").slideUp("slow");
+ $("input#endpoint_list_button").val("Select endpoint");
+ $("input#endpoint_list_button").toggleClass("ok_button", false);
+ }
+ });
+ });
+
.input
%p
@@ -25,7 +52,8 @@
format:
%input{:type => 'file', :name => 'file', :id => 'file', :size => '41'}
%br
- -# = haml :model_echa, :layout => false
+ = haml :create_echa, :layout => false
+ %br
%input{ :type => "submit", :value => "Create model"}
=# link_to "Cancel", '/create'
diff --git a/views/create_echa.haml b/views/create_echa.haml
new file mode 100644
index 0000000..4815c35
--- /dev/null
+++ b/views/create_echa.haml
@@ -0,0 +1,2 @@
+For endpoint:
+= endpoint_option_list() \ No newline at end of file
diff --git a/views/model.haml b/views/model.haml
index 356ec65..fb264ca 100644
--- a/views/model.haml
+++ b/views/model.haml
@@ -40,6 +40,9 @@
- if model.nr_compounds
%dt Training compounds:
%dd= model.nr_compounds
+ - if model.endpoint
+ %dt Endpoint:
+ %dd= model.endpoint
- if model.error_messages
%dt Errors:
%dd= model.error_messages
diff --git a/views/model_echa.haml b/views/model_echa.haml
deleted file mode 100644
index 257a28a..0000000
--- a/views/model_echa.haml
+++ /dev/null
@@ -1,2 +0,0 @@
-Select an endpoint:
-= endpoint_option_list \ No newline at end of file
diff --git a/views/models.haml b/views/models.haml
index 1419e37..af11a32 100644
--- a/views/models.haml
+++ b/views/models.haml
@@ -26,3 +26,4 @@
= haml :model, :locals=>{:model=>model}, :layout => false
-if @models.size == 0
.notice There are currently no models. You have to create a model first.
+= models_navigation_bottom if @models.size > 1 \ No newline at end of file
diff --git a/views/models_navigation.haml b/views/models_navigation.haml
index b491cb5..c5eda97 100644
--- a/views/models_navigation.haml
+++ b/views/models_navigation.haml
@@ -1,12 +1,12 @@
.models_navigation
-
+ - js = ""
%form{:name => "nav", :action => url_for('/models'), :method => "get", :id => "nav"}
%input{:type => :hidden, :name => :sort_by, :id => "sort_by", :value => params[:sort_by]}
%input{:type => :hidden, :name => :order, :id => "order", :value => params[:order]}
%input{:type => :hidden, :name => :page, :id => "page", :value => params[:page]}
Sort by:
- - ["created_at","name","type"].each do |s|
+ - ["created_at","name","type","endpoint"].each do |s|
- idname = s == "created_at" ? "date" : s
- if params[:sort_by] == s
%div{:id => idname, :class => "active"}
@@ -22,32 +22,42 @@
- if @models.size > 5
|
Models:
- = "#{@models.size}"
- - unless @page.to_i == 0
- #prev
- %img{:src => "arrow_left.png", :alt => 'previous', :title => 'previous'}/
- -else
- %img{:src => "arrow_left_inactive.png", :alt => '', :title => ''}/
-
- if @models.size < 5*@page+5
- last = @models.size
- else
- last = 5*@page+5
-
- = "(#{5*@page+1}-#{last}/#{@models.size})"
+
+ = "#{5*@page+1}-#{last} / #{@models.size}"
+
+ | Page:
+ - unless @page.to_i == 0
+ #prev{:class => "link"}
+ %img{:src => "arrow_left.png", :alt => 'previous', :title => 'previous'}/
+ -else
+ %img{:src => "arrow_left_inactive.png", :alt => '', :title => ''}/
+
+ - (0..(@models.size/5).to_f.ceil-1).each do |p|
+ -if p != @page.to_f
+ %a{:href => '#', :id => "page_link_#{p}", :class => "page page_link"} #{p+1}
+ - js += "$('#page_link_#{p}').click(function() \{ \n"
+ - js += " $('#page').val('#{p}');\n"
+ - js += " $('#nav').submit();\n"
+ - js += "});\n"
+ -else
+ %span{:class => "page page_active"} #{p+1}
+
- unless 5*@page.to_i+5 >= @models.size
- #next
+ #next{:class => "link"}
%img{:src => "arrow_right.png", :alt => 'next', :title => 'next'}/
-else
%img{:src => "arrow_right_inactive.png", :alt => '', :title => ''}/
- - js = ""
- - ["id","created_at","name","type"].each do |s|
+ - ["created_at","name","type","endpoint"].each do |s|
- idname = s == "created_at" ? "date" : s
- - js += "$('##{idname}').click(function() \{ \n "
- - js += " $('#sort_by').val('#{s}');\n "
- - js += " $('#nav').submit();\n "
- - js += "});\n "
+ - js += "$('##{idname}').click(function() \{ \n"
+ - js += " $('#sort_by').val('#{s}');\n"
+ - js += " $('#nav').submit();\n"
+ - js += "});\n"
:javascript
$("#prev").click(function() {
diff --git a/views/models_navigation_bottom.haml b/views/models_navigation_bottom.haml
new file mode 100644
index 0000000..b2425fa
--- /dev/null
+++ b/views/models_navigation_bottom.haml
@@ -0,0 +1,42 @@
+.models_navigation
+ - js = ""
+ - if @models.size > 5
+ Models:
+ - if @models.size < 5*@page+5
+ - last = @models.size
+ - else
+ - last = 5*@page+5
+ = "#{5*@page+1}-#{last} / #{@models.size}"
+ | Page:
+ - unless @page.to_i == 0
+ #prevbot{:class => "link"}
+ %img{:src => "arrow_left.png", :alt => 'previous', :title => 'previous'}/
+ -else
+ %img{:src => "arrow_left_inactive.png", :alt => '', :title => ''}/
+
+ - (0..(@models.size/5).to_f.ceil-1).each do |p|
+ -if p != @page.to_f
+ %a{:href => '#', :id => "page_linkbot_#{p}", :class => "page page_link"} #{p+1}
+ - js += "$('#page_linkbot_#{p}').click(function() \{ \n"
+ - js += " $('#page').val('#{p}');\n"
+ - js += " $('#nav').submit();\n"
+ - js += "});\n"
+ -else
+ %span{:class => "page page_active"} #{p+1}
+
+ - unless 5*@page.to_i+5 >= @models.size
+ #nextbot{:class => "link"}
+ %img{:src => "arrow_right.png", :alt => 'next', :title => 'next'}/
+ -else
+ %img{:src => "arrow_right_inactive.png", :alt => '', :title => ''}/
+
+ :javascript
+ $("#prevbot").click(function() {
+ $("#page").val(#{@page-1});
+ $("#nav").submit();
+ });
+ $("#nextbot").click(function() {
+ $("#page").val(#{@page+1});
+ $("#nav").submit();
+ });
+ #{js} \ No newline at end of file
diff --git a/views/neighbors.haml b/views/neighbors.haml
index e2d65fa..49b72b7 100644
--- a/views/neighbors.haml
+++ b/views/neighbors.haml
@@ -14,7 +14,7 @@
- compound = OpenTox::Compound.new(neighbor[OT.compound])
%tr
%td.image= compound_image(compound,@prediction.descriptors(compound),@value_map)
- %td= activity_markup(neighbor[OT.measuredActivity], @value_map)
+ %td= activity_markup(neighbor[OT.measuredActivity].to_s, @value_map)
%td= sprintf('%.03g', neighbor[OT.similarity])
%td
%ul
diff --git a/views/predict.haml b/views/predict.haml
index 670ca44..c6097ac 100644
--- a/views/predict.haml
+++ b/views/predict.haml
@@ -30,7 +30,12 @@
%legend
Choose one or more prediction models
%br
+ - endpoint = ''
- @models.each do |model|
+ -if model.endpoint != endpoint
+ -endpoint = model.endpoint
+ %b #{endpoint}:
+ %br
%input{:type => 'checkbox', :name => "selection[#{model.id}]", :value => true, :id => "model#{model.id}", :disabled => false}
%label{:for => "model#{model.id}"}
= model.name
diff --git a/views/style.sass b/views/style.sass
index c2a74cb..230c13c 100644
--- a/views/style.sass
+++ b/views/style.sass
@@ -5,6 +5,7 @@ $ot_purple: #5d308a
$body_color: white
$text_color: black
$notice_border: red
+$mouseover: #FFFF69
body
min-width: 30em
@@ -269,14 +270,7 @@ dl
float: left
.models_navigation
- #prev
- @extend a
- display: inline
- cursor: pointer
- #next
- @extend a
- display: inline
- cursor: pointer
+ margin-top: 4px
.link
@extend a
display: inline
@@ -287,13 +281,59 @@ dl
font-weight: bold
.thin
font-weight: 100
+ .page
+ border: solid 1px #999
+ background-color: #FFF
+ padding: 0px 3px
+ font-size: 94%
+ font-weight: bold
+ .page_link:hover
+ border-color: #000
+ color: #000
+ .page_active
+ background-color: #ccd2dc
+ color: #000
+ font-weight: bold
+ border-right-color: #000
+ border-bottom-color: #000
+
+ul.endpoint
+ list-style-type: none
+ margin-left: 0px
+ padding-left: 0px
+
+ul.level_2
+ display: none
+ul.level_3
+ display: none
+ul.level_4
+ display: none
.level_1
- padding-left: 10px
+ margin-left: 0px
font-weight: bold
.level_2
- padding-left: 20px
+ margin-left: 20px
+ font-weight: normal
.level_3
- padding-left: 30px
+ margin-left: 40px
+ font-weight: normal
.level_4
- padding-left: 40px
+ margin-left: 60px
+ font-weight: normal
+
+#endpoint_label
+ font-weight: bold
+ margin: 0 10px
+
+ul.endpoint
+ label:hover, label:active
+ background-color: $mouseover
+ border-bottom: solid #999 1px
+ border-top: solid #999 1px
+
+#div_endpoint
+ display: none
+
+.ok_button
+ background-color: $mouseover