summaryrefslogtreecommitdiff
path: root/helper.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2010-08-06 13:30:15 +0200
committerChristoph Helma <helma@in-silico.ch>2010-08-06 13:30:15 +0200
commit4315a4ef2bfc625dc2f3ed69dd6c90ddb0dd5593 (patch)
tree82d7520fba83cb2d5652ae7f61767cb112e72f94 /helper.rb
parent05ed7ad074f48cf36b60740665c1a0962ff0a55d (diff)
lazar details implemented
Diffstat (limited to 'helper.rb')
-rw-r--r--helper.rb48
1 files changed, 37 insertions, 11 deletions
diff --git a/helper.rb b/helper.rb
index 4a5f739..9c4b04c 100644
--- a/helper.rb
+++ b/helper.rb
@@ -1,14 +1,40 @@
helpers do
- def activity(a)
- case a.to_s
- when "true"
- act = "active"
- when "false"
- act = "inactive"
- else
- act = "not available"
- end
- act
- end
+
+ def hide_link(destination)
+ @link_id = 0 unless @link_id
+ @link_id += 1
+ haml :js_link, :locals => {:name => "hide", :destination => destination, :method => "hide"}, :layout => false
+ end
+
+ def toggle_link(destination,name)
+ @link_id = 0 unless @link_id
+ @link_id += 1
+ haml :js_link, :locals => {:name => name, :destination => destination, :method => "toggle"}, :layout => false
+ end
+
+ def compound_image(compound,features)
+ haml :compound_image, :locals => {:compound => compound, :features => features}, :layout => false
+ end
+
+ def activity_markup(activity)
+ case activity.class.to_s
+ when /Float/
+ haml ".other #{sprintf('%.03g', activity)}", :layout => false
+ else
+ if activity #true
+ haml ".active active", :layout => false
+ elsif !activity # false
+ haml ".inactive inactive", :layout => false
+ else
+ haml ".other #{activity.to_s}", :layout => false
+ end
+ end
+ end
+
+ def neighbors_navigation
+ @page = 0 unless @page
+ haml :neighbors_navigation, :layout => false
+ end
+
end