Displaying clickable images in BLAST results


I would like to use the image_tag() of the ActionView (http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html) within the views/result.erb to display a clickable image.

<% query.hits.each_with_index do |hit, h| %>

<%= h + 1 %>. "><%= "#{hit.id}" %> <%= prettify hit.score %> <%= prettify hit.evalue %> <%= prettify hit.length %> **<%= link_to image_tag("images/icon-B.png"), "http://URL" %>**

Where should I include the action_view so that I can run SequenceServer without getting the error: “NoMethodError - undefined method `image_tag’”

Thank you.

In routes.rb. Also see this - http://www.danstutzman.com/2013/07/how-to-use-rails-form-helpers-from-sinatra.

Do note that there’s no guarantee that this will work with future releases of SequenceServer. In particular, we are moving to client side rendering in the next release and as such any changes to the interface except the primary layout and adding hit links will have to be done via JS.

– Priyam

Hi Priyam,

If I just want to add an tag, e.g. Image in the views/result.erb, how should I specify the location of the src; my images are located in the public/images/ folder?

Any file in public/ can be referenced as a URL like so: http://localhost:4567/images/my_image.png. As a relative URL the same will be ‘images/my_image.png’.

So you can say:

– Priyam