Skip to content

Commit

Permalink
do some renaming, add s3_uploader method alias for s3_uploader_form
Browse files Browse the repository at this point in the history
  • Loading branch information
ncri committed Jun 26, 2015
1 parent e4ab3a5 commit 9aef36d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/s3_direct_upload/form_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ module S3DirectUpload
module UploadHelper
def s3_uploader_form(options = {}, &block)
uploader = S3Uploader.new(options)
content_tag(:div, uploader.form_options) do
content_tag(:div, uploader.wrapper_options) do
uploader.fields.map do |name, value|
hidden_field_tag(name, value)
end.join.html_safe + capture(&block)
end
end

alias_method :s3_uploader, :s3_uploader_form

class S3Uploader
def initialize(options)
@key_starts_with = options[:key_starts_with] || "uploads/"
Expand All @@ -29,12 +31,10 @@ def initialize(options)
)
end

def form_options
def wrapper_options
{
id: @options[:id],
class: @options[:class],
method: "post",
multipart: true,
data: {
callback_url: @options[:callback_url],
callback_method: @options[:callback_method],
Expand Down

0 comments on commit 9aef36d

Please sign in to comment.