Skip to content

Commit

Permalink
Adding 'store_container' as a form helper data option ('data-fp-*')
Browse files Browse the repository at this point in the history
  • Loading branch information
smudge committed Feb 9, 2015
1 parent 4218438 commit bc15c84
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/helpers/filepicker_rails/form_helper.rb
Expand Up @@ -4,7 +4,8 @@ module FormHelper
FILEPICKER_OPTIONS_TO_DASHERIZE = [:button_text, :button_class, :mimetypes,
:extensions, :container, :services,
:drag_text, :drag_class, :store_path,
:store_location, :store_access, :multiple]
:store_location, :store_access,
:store_container, :multiple]

FILEPICKER_OPTIONS_TO_CAMELIZE = [:max_size, :max_files]

Expand All @@ -21,6 +22,7 @@ module FormHelper
# - `:services` - What services your users can upload to. Ex: `BOX, COMPUTER, FACEBOOK`.
# - `:store_path` - The path to store the file at within the specified file store.
# - `:store_location` - The file is not copied by default. It remains in the original location. If you wish you have the file copied onto your own storage, you can specify where we should put the copy. The only value at the moment is `S3`.
# - `:store_container` - The bucket or container in your specified `store_location`. Defaults to the container specified in the developer portal. Does not apply to Dropbox storage.
# - `:store_access` - Should the underlying file be publicly available on its S3 link. Options are `public` and `private`, defaults to 'private'.
# - `:dragdrop` - (`true` or `false`) Whether or not to allow drag-and-drop uploads.
# - `:drag_text` - The text of the dragdrop pane.
Expand Down
5 changes: 5 additions & 0 deletions spec/helpers/form_helper_spec.rb
Expand Up @@ -97,6 +97,11 @@
expect(form.filepicker_field(:filepicker_url, store_location: "S3")).to include(attribute)
end

it "have correct input with 'store_container'" do
attribute = %{data-fp-store-container="my-bucket"}
expect(form.filepicker_field(:filepicker_url, store_container: "my-bucket")).to include(attribute)
end

it "have correct input with 'store_access'" do
attribute = %{data-fp-store-access="public"}
expect(form.filepicker_field(:filepicker_url, store_access: "public")).to include(attribute)
Expand Down

0 comments on commit bc15c84

Please sign in to comment.