Sha256: 6417f1ce3de091890f020be7081a45a3e2ff5027a2cb50f2708635d3f38b03d6
Contents?: true
Size: 643 Bytes
Versions: 2
Compression:
Stored size: 643 Bytes
Contents
module DocumentsHelper FORMATS = ["msword","vnd.ms-powerpoint","msexcel","rar","zip","mp3","plain","pdf"] def thumb_for(document) format = document.file_content_type if FORMATS.include?(format.split('/')[1]) image_tag 'formats/'+format.split('/')[1]+'.png' else if is_image?(document) image_tag document.file.url(:thumb)+"?style=thumb" else image_tag 'formats/default.png' end end end def wrap_file_name(name) name if(name.length > 12) name[0,12]+"..." end end def is_image?(document) !(document.file_content_type =~ /^image.*/).nil? end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
social_stream-documents-0.1.1 | app/helpers/documents_helper.rb |
social_stream-documents-0.1.0 | app/helpers/documents_helper.rb |