Sha256: 408c7b2057ba9a4f36f36061e9d503b7a6561d3a65c9de8da7556db11aa18c3d
Contents?: true
Size: 995 Bytes
Versions: 17
Compression:
Stored size: 995 Bytes
Contents
module Models module Extensions module Asset module Vignette def vignette_url if self.image? if self.width < 80 && self.height < 80 self.source.url else self.source.url(:medium) end # elsif asset.pdf? # image_tag(asset.source.url(:medium)) else mime_type_to_url(:medium) end end protected def mime_type_to_url(size) mime_type = File.mime_type?(self.source_filename) filename = "unknown" if !(mime_type =~ /pdf/).nil? filename = "PDF" elsif !(mime_type =~ /css/).nil? filename = "CSS" elsif !(mime_type =~ /javascript/).nil? filename = "JAVA" end File.join("admin", "icons", "filetype", size.to_s, filename + ".png") end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems