Module: FileUpload::TagHelper

Defined in:
app/helpers/file_upload/tag_helper.rb

Instance Method Summary collapse

Instance Method Details

#file_size(file) ⇒ Object


21
22
23
# File 'app/helpers/file_upload/tag_helper.rb', line 21

def file_size(file)
  number_with_precision(file.size / 1024.0, precision: 2)
end

#multiple_file_upload_field(model_name, attribute_name, value, options = {}, &block) ⇒ Object


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

def multiple_file_upload_field(model_name, attribute_name, value, options = {}, &block)
  render(layout: "file_upload/tags/multiple", locals: {
    model_name: model_name,
    attribute_name: attribute_name,
    value: value,
    options: options
  }, &block)
end

#single_file_upload_field(model_name, attribute_name, value, options = {}, &block) ⇒ Object


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

def single_file_upload_field(model_name, attribute_name, value, options = {}, &block)
  render(layout: "file_upload/tags/single", locals: {
    model_name: model_name,
    attribute_name: attribute_name,
    value: value,
    options: options
  }, &block)
end