diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2017-07-31 16:23:37 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2017-07-31 16:23:37 -0500 |
commit | ba12811db22de23e935b43f39cac8da523fa0ded (patch) | |
tree | d0f03c908f4df608e9da8c06cfb9f77638263f2a /actionview/lib/action_view/helpers/form_tag_helper.rb | |
parent | 5beb87c7b1689212848b14a3977dad7d3514f30a (diff) | |
download | rails-ba12811db22de23e935b43f39cac8da523fa0ded.tar.gz rails-ba12811db22de23e935b43f39cac8da523fa0ded.tar.bz2 rails-ba12811db22de23e935b43f39cac8da523fa0ded.zip |
Move the direct_upload: true convenience option from the activestorage helper into actionview
Diffstat (limited to 'actionview/lib/action_view/helpers/form_tag_helper.rb')
-rw-r--r-- | actionview/lib/action_view/helpers/form_tag_helper.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb index 91046acbf8..83b600d871 100644 --- a/actionview/lib/action_view/helpers/form_tag_helper.rb +++ b/actionview/lib/action_view/helpers/form_tag_helper.rb @@ -274,7 +274,7 @@ module ActionView # file_field_tag 'file', accept: 'text/html', class: 'upload', value: 'index.html' # # => <input accept="text/html" class="upload" id="file" name="file" type="file" value="index.html" /> def file_field_tag(name, options = {}) - text_field_tag(name, nil, options.merge(type: :file)) + text_field_tag(name, nil, convert_direct_upload_option_to_url(options.merge(type: :file))) end # Creates a password field, a masked text field that will hide the users input behind a mask character. @@ -904,6 +904,10 @@ module ActionView tag_options.delete("data-disable-with") end + + 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 end |