Module: DocumentsHelper

Defined in:
app/helpers/documents_helper.rb

Instance Method Summary collapse

Instance Method Details

#document_image_path(document) ⇒ Object

Return document thumbnail/icon



13
14
15
16
17
18
19
# File 'app/helpers/documents_helper.rb', line 13

def document_image_path(document)
  if !(document.attachment.content_type =~ /^image/).nil? 
    document.attachment(:micro)
  else
    '/assets/icons/file_extension/file_extension_' + (Document::FILE_EXTENSION_ICON[document.attachment.content_type].presence || '') + '.png'
  end
end

#document_image_tag(document) ⇒ Object

Return document thumbnail/icon



4
5
6
7
8
9
10
# File 'app/helpers/documents_helper.rb', line 4

def document_image_tag(document)
  if !(document.attachment.content_type =~ /^image/).nil? 
    image_tag document.attachment(:micro)
  else
    image_tag 'icons/file_extension/file_extension_' + (Document::FILE_EXTENSION_ICON[document.attachment.content_type].presence || '') + '.png'
  end
end