Module: EffectiveAssetsS3Helper

Defined in:
app/helpers/effective_assets_s3_helper.rb

Defined Under Namespace

Classes: S3Uploader

Instance Method Summary collapse

Instance Method Details

#s3_uploader_fields(options = {}) ⇒ Object



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

def s3_uploader_fields(options = {})
  S3Uploader.new(options).fields.map do |name, value|
    hidden_field_tag(name, value, disabled: 'disabled')
  end.join.html_safe
end

#s3_uploader_input_js_options(options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/effective_assets_s3_helper.rb', line 9

def s3_uploader_input_js_options(options = {})
  {
    url: (Effective::Asset.s3_base_path.chomp('/') + '/'),
    remove_completed_progress_bar: true,
    allow_multiple_files: (options[:limit].to_i > 1),
    file_types: Array(options[:file_types]).flatten.join('|').to_s,
    create_asset_url: effective_assets.s3_uploads_url,
    update_asset_url: "#{effective_assets.s3_uploads_url}/:id",
    click_submit: (options[:click_submit] == true)
  }.to_json()
end