class ActionView::Helpers::FormBuilder
Public Instance Methods
filemagic_field(attribute_name, options={})
click to toggle source
# File lib/filemagic/engine.rb, line 53 def filemagic_field(attribute_name, options={}) image_size = options[:image_size] || {} preview_size = options[:preview_size] || {} preview_url = Refile.attachment_url(@object, attribute_name) || '' is_file_field = options[:is_file_field] || false actions = options[:actions] || false input_html_options = options[:input_html] || false custom_attribute_name = input_html_options ? input_html_options[:name] : false data_attributes = { component: 'Uploader', object: object_name, attribute: attribute_name, custom_attribute_name: custom_attribute_name, offset_y: options[:offset_y] || false, image_size: image_size, preview_size: preview_size, preview_url: preview_url, as: "file", url: "/attachments/cache", fields: {}, is_file_field: is_file_field, actions: actions } data_attributes = data_attributes.merge(Refile.cache.presign.as_json) if Refile.cache.class.method_defined?(:presign) @template.content_tag(:div, nil, { class: 'fm-uploader-wrapper', data: data_attributes}) end