Class: Conjoin::FormBuilder::FileInput

Inherits:
Input
  • Object
show all
Defined in:
lib/conjoin/inputs/file.rb

Instance Attribute Summary

Attributes inherited from Input

#app, #data, #options, #record

Instance Method Summary collapse

Methods inherited from Input

#errors?, #id, #initialize, #nested_name, #render

Constructor Details

This class inherits a constructor from Conjoin::FormBuilder::Input

Instance Method Details

#displayObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/conjoin/inputs/file.rb', line 4

def display
  key = options[:s3_upload_path].call(record)

  mab do
    unless options[:value]
      div id: id, name: options[:name], class: 'file s3-uploader', value: options[:value]
    end
    input id: id, type: :hidden, name: options[:name], class: 'form-control file s3-uploader', value: options[:value]
    text! S3Uploader.js_button(id, key, options[:callback_url], options[:callback_params])
  end
end