lib/sunrise/file_upload/view_helper.rb in sunrise-file-upload-0.1.1 vs lib/sunrise/file_upload/view_helper.rb in sunrise-file-upload-0.1.2

- old
+ new

@@ -14,26 +14,24 @@ element_id = dom_id(object, [method, element_guid].join('_')) script_options = (options.delete(:script) || {}).stringify_keys params = { - :klass => value.class.name, + :method => method, :assetable_id => object.new_record? ? nil : object.id, :assetable_type => object.class.name, :guid => element_guid }.merge(script_options.delete(:params) || {}) script_options['action'] ||= '/sunrise/fileupload?' + Rack::Utils.build_query(params) script_options['allowedExtensions'] ||= ['jpg', 'jpeg', 'png', 'gif'] script_options['multiple'] ||= object.fileupload_multiple?(method) - content_tag(:div, :class => 'fileupload') do - content_tag(:div, :id => element_id) do - content_tag(:noscript) do - fields_for object do |form| - form.fields_for method, value do |f| - f.file_field :data - end + content_tag(:div, :class => 'fileupload', :id => element_id) do + content_tag(:noscript) do + fields_for object do |form| + form.fields_for method, value do |f| + f.file_field :data end end end + javascript_tag( fileupload_script(element_id, value, script_options) ) end end