From ba12811db22de23e935b43f39cac8da523fa0ded Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 31 Jul 2017 16:23:37 -0500 Subject: Move the direct_upload: true convenience option from the activestorage helper into actionview --- .../file_field_with_direct_upload_helper.rb | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 activestorage/app/helpers/active_storage/file_field_with_direct_upload_helper.rb (limited to 'activestorage') diff --git a/activestorage/app/helpers/active_storage/file_field_with_direct_upload_helper.rb b/activestorage/app/helpers/active_storage/file_field_with_direct_upload_helper.rb deleted file mode 100644 index 7c5fd0eb55..0000000000 --- a/activestorage/app/helpers/active_storage/file_field_with_direct_upload_helper.rb +++ /dev/null @@ -1,18 +0,0 @@ -module ActiveStorage - # Temporary hack to overwrite the default file_field_tag and Form#file_field to accept a direct_upload: true option - # that then gets replaced with a data-direct-upload-url attribute with the route prefilled. - module FileFieldWithDirectUploadHelper - def file_field_tag(name, options = {}) - text_field_tag(name, nil, convert_direct_upload_option_to_url(options.merge(type: :file))) - end - - def file_field(object_name, method, options = {}) - ActionView::Helpers::Tags::FileField.new(object_name, method, self, convert_direct_upload_option_to_url(options)).render - end - - private - def convert_direct_upload_option_to_url(options) - options.merge('data-direct-upload-url': options.delete(:direct_upload) ? rails_direct_uploads_url : nil).compact - end - end -end -- cgit v1.2.3