diff options
author | Christoph Helma <helma@in-silico.ch> | 2010-08-06 13:30:15 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2010-08-06 13:30:15 +0200 |
commit | 4315a4ef2bfc625dc2f3ed69dd6c90ddb0dd5593 (patch) | |
tree | 82d7520fba83cb2d5652ae7f61767cb112e72f94 /helper.rb | |
parent | 05ed7ad074f48cf36b60740665c1a0962ff0a55d (diff) |
lazar details implemented
Diffstat (limited to 'helper.rb')
-rw-r--r-- | helper.rb | 48 |
1 files changed, 37 insertions, 11 deletions
@@ -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 |