Class: Tessa::AssetInput

Inherits:
SimpleForm::Inputs::Base
  • Object
show all
Defined in:
lib/tessa/simple_form/asset_input.rb

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options = nil) ⇒ Object

Raises:

  • (StandardError)


3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/tessa/simple_form/asset_input.rb', line 3

def input(wrapper_options=nil)
  raise StandardError, "AssetInput with multiple: true not yet supported" if options[:multiple]

  template.(
    :div,
    hidden_fields_for(attribute_name),
    "class" => "tessa-upload dropzone #{"multiple" if options[:multiple]}",
    "data-dropzone-options" => (options[:dropzone] || {}).to_json,
    "data-input-name" => "#{object_name}[#{attribute_name}]",
    "data-direct-upload-url" => Rails.application.routes.url_helpers.rails_direct_uploads_path,
  )
end