Module: AttachmentsHelper

Defined in:
app/helpers/attachments_helper.rb

Overview

Helper-functions for Attachments

Instance Method Summary (collapse)

Instance Method Details

- (Object) label_for_attachment(f)

String - html-code with a link to download the original file and some meta-data.

Parameters:

  • f (FormHelper)

Returns:

  • String - html-code with a link to download the original file and some meta-data.



6
7
8
9
10
11
12
# File 'app/helpers/attachments_helper.rb', line 6

def label_for_attachment(f)
  rc  = link_to( link_text(f.object), f.object.file.url(:original), :class => 'nostyle-link' )
  rc += " "
  rc += (f.object.file_file_size/1024).round.to_s
  rc += " KB, "+f.object.file_content_type
  raw rc.html_safe
end