dropzone_input 0.0.5 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29af54ca3530c83f97b12727e86951b989eba2dedbf11d2baab57d54eaee6c38
4
- data.tar.gz: 21bf9ec2f28984024db66804126f8db3ab49e1cba5fd2647ba72dc8681f5f147
3
+ metadata.gz: 1b6978df16683e71da246485abbe9c61910077247541602e200a05ad0efdd905
4
+ data.tar.gz: fe74ecd3c03b1ae6e7aac747ea4544e9c6dc8ab528ae6c816b19d26e79a555b2
5
5
  SHA512:
6
- metadata.gz: 01257afdc1a0729a6c9ecb968689654cddabb0ebec583a18992f36e6ab307820c5e35351dd481e494e7c058137f34442d3d816f589483a729ccbfb928dcf4ae8
7
- data.tar.gz: d0d876b6e9898352021bcac39f9628e5c6ab13058e4f5311c0a147974c5195484975b391cf090a16f53b89e19eb07202c4b233939418722b7a8248fa16865972
6
+ metadata.gz: d3fbc2dfe54ad8085941b3f942323f52ae3216835601ec0e0c491b1427f98c1ee2503e08d6e18dbee692938473f809ad370f2c7e7d59571d462c945b1443a2b7
7
+ data.tar.gz: 52576d435d1818871a8498890cfba6540220e14e3947a8ce750a26a658dfa0efeac57ab81ad59ec9576c47e9a433800a1782df04658e41ccea5904cf3911c3af
data/README.md CHANGED
@@ -6,6 +6,7 @@ A Rails helper and Stimulus Controller that makes adding dropzone to a Rails for
6
6
  <%= form_with(model: User.new) do |form| %>
7
7
  <%= dropzone form, :image,
8
8
  file_success_event: 'USER_FILE_UPLOADED',
9
+ file_progress_event: 'USER_FILE_PROGRESS',
9
10
  queue_complete_event: 'USER_FILE_UPLOAD_DONE' %>
10
11
  <% end %>
11
12
  ```
@@ -14,6 +15,24 @@ A Rails helper and Stimulus Controller that makes adding dropzone to a Rails for
14
15
  specific styles, etc) will be non-configurable at the moment. We will work to generalize this over
15
16
  time and *pull requests are welcome* and will be reviewed quickly.
16
17
 
18
+ ## Options & Events
19
+
20
+ | Option Name | Description |
21
+ | -- | -- |
22
+ | `max_files` | default: `null` |
23
+ | `max_file_size` | default: `null` |
24
+ | `parallel_uploads` | default: `2` |
25
+
26
+ Events below receive `file` as first parameter.
27
+
28
+ | Event Name | Description |
29
+ | -- | -- |
30
+ | `file_added_event` | File added to queue |
31
+ | `file_progress_event` | Periodically called while file is being uploaded. `progress` in the second parameter, or through the `upload` property: `file.upload.progress`, `file.upload.bytesSent` |
32
+ | `file_removed_event` | File removed from queue |
33
+ | `file_start_event` | File will start uploading |
34
+ | `file_success_event` | File successfully uploaded |
35
+
17
36
  ## Installation
18
37
 
19
38
  Add to your Gemfile.
@@ -1,4 +1,4 @@
1
- <%= form.file_field field, direct_upload: true, data: { target: 'dropzone.input' } %>
1
+ <%= form.file_field field, direct_upload: true, data: { 'dropzone-target': 'input' } %>
2
2
  <div class="dz-default dz-message">
3
3
  <%= yield %>
4
4
  </div>
@@ -12,7 +12,20 @@ module DropzoneInput
12
12
  controller: 'dropzone',
13
13
  dropzone_accepted_files: ActiveStorage.variable_content_types.join(',')
14
14
  }
15
- %i( max_files max_file_size file_drop_event file_success_event queue_complete_event file_drop_id file_drop_over_id ).each do |key|
15
+ %i(
16
+ max_files
17
+ max_file_size
18
+ file_added_event
19
+ file_drop_event
20
+ file_drop_id
21
+ file_drop_over_id
22
+ file_progress_event
23
+ file_removed_event
24
+ file_start_event
25
+ file_success_event
26
+ parallel_uploads
27
+ queue_complete_event
28
+ ).each do |key|
16
29
  data["dropzone_#{key}".to_sym] = options.delete(key) if options.key?(key)
17
30
  end
18
31
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DropzoneInput
4
- VERSION = '0.0.5'
4
+ VERSION = '1.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dropzone_input
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trae Robrock
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-09 00:00:00.000000000 Z
11
+ date: 2021-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails