Added thumbnail option to #link_to_if_arvados_object, enabled on pipeline instance...
[arvados.git] / apps / workbench / app / helpers / collections_helper.rb
1 module CollectionsHelper
2   def d3ify_links(links)
3     links.collect do |x|
4       {source: x.tail_uuid, target: x.head_uuid, type: x.name}
5     end
6   end
7
8   def self.match(uuid)
9     /^([a-f0-9]{32})(\+[0-9]+)?(\+.*?)?(\/.*)?$/.match(uuid.to_s)
10   end
11
12   def self.is_image file
13     /\.(jpg|jpeg|gif|png|svg)$/i.match(file)
14   end
15
16   def self.file_path file
17     f0 = file[0]
18     f0 = '' if f0 == '.'
19     f0 = f0[2..-1] if f0[0..1] == './'
20     f0 += '/' if not f0.empty?
21     file_path = "#{f0}#{file[1]}"
22   end
23 end