dropzone_input 0.0.2 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4f03cfcfa9114f7c9121c5c82a9d307ce69c9a0c5a27789e906ed1692969234
|
4
|
+
data.tar.gz: 3d90a1417cacd85afb1ecb3558b5bad166c38df14512bc35e23578fed8d618d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8466730e8d6a1fac07e1ed5b9131559958e9848ce8ea2136cea37ae9d825e41d9efb5a530dc3da4187fb3a6fce142dc2de7d65c170b320a2a8237f295c98cca0
|
7
|
+
data.tar.gz: 4715a836cd355621bfd9091c2dd493e479f2f65d24d79df264158e616cfbd4f53e9b9a49c2359bb5934b521241fb128ba6a8c24e4783f4314da60faa51a42d81
|
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
|
```
|
@@ -16,7 +17,7 @@ time and *pull requests are welcome* and will be reviewed quickly.
|
|
16
17
|
|
17
18
|
## Installation
|
18
19
|
|
19
|
-
Add to your Gemfile
|
20
|
+
Add to your Gemfile.
|
20
21
|
|
21
22
|
```ruby
|
22
23
|
gem 'dropzone_input'
|
@@ -24,10 +25,23 @@ gem 'dropzone_input'
|
|
24
25
|
|
25
26
|
```sh
|
26
27
|
bundle install
|
28
|
+
```
|
29
|
+
|
30
|
+
Add Javascript dependencies.
|
31
|
+
|
32
|
+
```
|
27
33
|
yarn add dropzone # If you don't already have this
|
28
34
|
yarn add @darkroom-com/dropzone-input
|
29
35
|
```
|
30
36
|
|
37
|
+
Register Stimulus controller. By default in Rails, this is in `controllers/index.js`.
|
38
|
+
|
39
|
+
```js
|
40
|
+
import DropzoneController from '@darkroom-com/dropzone-input';
|
41
|
+
|
42
|
+
application.register('dropzone', DropzoneController);
|
43
|
+
```
|
44
|
+
|
31
45
|
## Development
|
32
46
|
|
33
47
|
To develop this locally you can update your Gemfile to
|
@@ -45,7 +59,7 @@ yarn link
|
|
45
59
|
In your app project run
|
46
60
|
|
47
61
|
```sh
|
48
|
-
yarn
|
62
|
+
yarn link @darkroom-com/dropzone-input
|
49
63
|
```
|
50
64
|
|
51
65
|
To auto-recompile this project, run
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<svg enable-background="new 0 0 72 43.2" version="1.1" viewBox="0 0 72 43.2" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" class="inline-block w-16 mb-1">
|
3
|
+
<style type="text/css">
|
4
|
+
.st0{fill:none;stroke:#424443;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
5
|
+
</style>
|
6
|
+
<polyline class="st0" points="28.3 26.3 34.4 20.3 40.4 26.3 34.4 20.3 34.4 42.3"/>
|
7
|
+
<path class="st0" d="m22.1 33c-6.6 0-11.9-5.3-11.9-11.9s5.4-11.9 11.9-11.9c2.4-4.9 7.4-8.3 13.3-8.3 7.6 0 13.9 5.8 14.7 13.2 0.7-0.1 1.3-0.2 2-0.2 5.3 0 9.5 4.3 9.5 9.5s-4.1 9.6-9.4 9.6h-5.6"/>
|
8
|
+
</svg>
|
9
|
+
<h1 class="text-xl text-gray-700">Upload</h1>
|
@@ -1,12 +1,4 @@
|
|
1
|
-
<%= form.file_field field, direct_upload: true, data: { target: '
|
1
|
+
<%= form.file_field field, direct_upload: true, data: { 'dropzone-target': 'input' } %>
|
2
2
|
<div class="dz-default dz-message">
|
3
|
-
|
4
|
-
<svg enable-background="new 0 0 72 43.2" version="1.1" viewBox="0 0 72 43.2" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" class="inline-block w-16 mb-1">
|
5
|
-
<style type="text/css">
|
6
|
-
.st0{fill:none;stroke:#424443;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
|
7
|
-
</style>
|
8
|
-
<polyline class="st0" points="28.3 26.3 34.4 20.3 40.4 26.3 34.4 20.3 34.4 42.3"/>
|
9
|
-
<path class="st0" d="m22.1 33c-6.6 0-11.9-5.3-11.9-11.9s5.4-11.9 11.9-11.9c2.4-4.9 7.4-8.3 13.3-8.3 7.6 0 13.9 5.8 14.7 13.2 0.7-0.1 1.3-0.2 2-0.2 5.3 0 9.5 4.3 9.5 9.5s-4.1 9.6-9.4 9.6h-5.6"/>
|
10
|
-
</svg>
|
11
|
-
<h1 class="text-xl text-gray-700">Upload</h1>
|
3
|
+
<%= yield %>
|
12
4
|
</div>
|
@@ -12,12 +12,23 @@ module DropzoneInput
|
|
12
12
|
controller: 'dropzone',
|
13
13
|
dropzone_accepted_files: ActiveStorage.variable_content_types.join(',')
|
14
14
|
}
|
15
|
-
%i(
|
15
|
+
%i(
|
16
|
+
max_files
|
17
|
+
max_file_size
|
18
|
+
file_drop_event
|
19
|
+
file_progress_event
|
20
|
+
file_success_event
|
21
|
+
queue_complete_event
|
22
|
+
file_drop_id
|
23
|
+
file_drop_over_id
|
24
|
+
).each do |key|
|
16
25
|
data["dropzone_#{key}".to_sym] = options.delete(key) if options.key?(key)
|
17
26
|
end
|
18
27
|
|
19
28
|
content_tag :div, options.merge(class: class_list, data: data) do
|
20
|
-
render
|
29
|
+
render 'dropzone_input/dropzone', form: form, field: field do
|
30
|
+
block_given? ? yield : render('dropzone_input/default_content')
|
31
|
+
end
|
21
32
|
end
|
22
33
|
end
|
23
34
|
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:
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trae Robrock
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -40,6 +40,7 @@ files:
|
|
40
40
|
- MIT-LICENSE
|
41
41
|
- README.md
|
42
42
|
- Rakefile
|
43
|
+
- app/views/dropzone_input/_default_content.html.erb
|
43
44
|
- app/views/dropzone_input/_dropzone.html.erb
|
44
45
|
- lib/dropzone_input.rb
|
45
46
|
- lib/dropzone_input/engine.rb
|
@@ -64,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
65
|
- !ruby/object:Gem::Version
|
65
66
|
version: '0'
|
66
67
|
requirements: []
|
67
|
-
rubygems_version: 3.1.
|
68
|
+
rubygems_version: 3.1.4
|
68
69
|
signing_key:
|
69
70
|
specification_version: 4
|
70
71
|
summary: A rails helper to easily add Dropzone to forms.
|