Module: DocumentsHelper

Defined in:
app/helpers/documents_helper.rb

Instance Method Summary collapse

Instance Method Details

#document_download(document) ⇒ Object



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

def document_download(document)
  return nil if document.nil?
  link_to(
    '',
    document.document_file.url(),
    class: ['circle-button', 'btn-download'],
    download: document.document_file_file_name,
    title: document.document_file_file_name) 
end


8
9
10
11
# File 'app/helpers/documents_helper.rb', line 8

def document_link(document)
  return nil if document.nil?
  link_to(document_tag(document).html_safe, document)
end

#document_tag(document) ⇒ Object



3
4
5
6
# File 'app/helpers/documents_helper.rb', line 3

def document_tag(document)
  return nil if document.nil?
  document.document_file_file_name
end

#document_type_label(document) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/helpers/documents_helper.rb', line 27

def document_type_label(document)
  case document.document_file_content_type
  when 'application/pdf'
    'pdf'
  when 'application/octet-stream'
    'binary (Word or other)'
  when 'text/plain'
    'text'
  when 'text/xml'
    'xml'
  end
end

#documents_search_formObject



23
24
25
# File 'app/helpers/documents_helper.rb', line 23

def documents_search_form
  render('/documents/quick_search_form')
end