Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog

- Add option for max number of files

## 1.3.0 (December 31, 2014)

### features
Expand Down
3 changes: 2 additions & 1 deletion app/helpers/filepicker_rails/form_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module FormHelper
:drag_text, :drag_class, :store_path,
:store_location, :store_access, :multiple]

FILEPICKER_OPTIONS_TO_CAMELIZE = [:max_size]
FILEPICKER_OPTIONS_TO_CAMELIZE = [:max_size, :max_files]

# Creates a filepicker field, accepts optional `options` hash for configuration.
#
Expand All @@ -27,6 +27,7 @@ module FormHelper
# - `:drag_class` - The class of the dragdrop pane.
# - `:onchange` - The onchange event.
# - `:max_size` - The maximum file size allowed, in bytes.
# - `:max_files` - The maximum number of files.
# - `:class` - Add a class to the input.
# - `:value` - Define the value of the input
#
Expand Down
5 changes: 5 additions & 0 deletions spec/helpers/form_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@
expect(form.filepicker_field(:filepicker_url, max_size: 10)).to include(attribute)
end

it "have correct input with 'max_files'" do
attribute = %{data-fp-maxFiles="10"}
expect(form.filepicker_field(:filepicker_url, max_files: 10)).to include(attribute)
end

it "have correct input with 'onchange'" do
attribute = %{onchange="track()"}
expect(form.filepicker_field(:filepicker_url, onchange: "track()")).to include(attribute)
Expand Down