Added thumbnail option to #link_to_if_arvados_object, enabled on pipeline instance...
[arvados.git] / apps / workbench / app / helpers / collections_helper.rb
index 7b548dfb84b4ae25a2bbe2e57ffa265d29118277..1f867a60b6725341ed274f9d862ca1d4f90c5f7a 100644 (file)
@@ -8,4 +8,16 @@ module CollectionsHelper
   def self.match(uuid)
     /^([a-f0-9]{32})(\+[0-9]+)?(\+.*?)?(\/.*)?$/.match(uuid.to_s)
   end
+
+  def self.is_image file
+    /\.(jpg|jpeg|gif|png|svg)$/i.match(file)
+  end
+
+  def self.file_path file
+    f0 = file[0]
+    f0 = '' if f0 == '.'
+    f0 = f0[2..-1] if f0[0..1] == './'
+    f0 += '/' if not f0.empty?
+    file_path = "#{f0}#{file[1]}"
+  end
 end