Module: DocumentsHelper

Defined in:
app/helpers/documents_helper.rb

Constant Summary collapse

FORMATS =
["msword","vnd.ms-powerpoint","msexcel","rar","zip","mp3","plain","pdf"]

Instance Method Summary collapse

Instance Method Details

#image_tag_for(document) ⇒ Object



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

def image_tag_for (document)
  image_tag download_document_path document, 
            :id => dom_id(document) + "_img"
end


20
21
22
23
24
# File 'app/helpers/documents_helper.rb', line 20

def link_for_wall(document)
  format = Mime::Type.lookup(document.file_content_type)

  polymorphic_path(document, :format => format, :style => 'thumb0')
end

#show_view_for(document) ⇒ Object



26
27
28
29
# File 'app/helpers/documents_helper.rb', line 26

def show_view_for(document)
  render :partial => document.class.to_s.pluralize.downcase + '/' + document.class.to_s.downcase + "_show",
         :locals => {document.class.to_s.downcase.to_sym => document}
end

#thumb_file_for(document, size) ⇒ Object



11
12
13
# File 'app/helpers/documents_helper.rb', line 11

def thumb_file_for(document, size)
  document.thumb(size, self)
end

#thumb_for(document, size) ⇒ Object

size can be any of the names that the document has size for



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

def thumb_for(document, size)
  image_tag document.thumb(size, self)
end