administrate-field-active_storage 0.1.4 → 0.1.5

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
  SHA1:
3
- metadata.gz: 9e3e3647b9b229f49a3072af6f62b72bc9d55976
4
- data.tar.gz: 5d6b454861f7e2e03e1cd0f7d8a99bab189c8748
3
+ metadata.gz: 755d9602f84c45d4532a6b4558eac449ecca6402
4
+ data.tar.gz: 9df7c208e8ca73ba25760f722455aaf408dc4aab
5
5
  SHA512:
6
- metadata.gz: dfc0eb316fb73d319b0d92b918472e98fa1e66625bb1e36bccbf02c1d1b61eda74a61cddb0d67e429473e7f8ce9729d965957cd3f9788e662f46cbc2073a478f
7
- data.tar.gz: c6f7543548f1039e099c65706f9b0bf70786d8fe531cd32ef6aeb6c593279c8aae0ab35c50758fdf5954700ff26bd53ec47c04c369489b3e11a8a94bf5606d7f
6
+ metadata.gz: 698a627b2ce86f2082ceae2d5c834826a0276a5c34c6571d4dddf4c56e3d6051093a2dde9c2a4eb36bb72d719321c8b9a46bdc6f22d8f9b533d5cbab16165983
7
+ data.tar.gz: 3c85acf2dc15008185de90f0b1659260ccbeefb7418432e5778e7a86751224b686639849d05f9eb028415ed1d4cdfe9e9fc0543312258fabd69d7a6e5e6a4b17
data/README.md CHANGED
@@ -87,6 +87,20 @@ class ModelDashboard < Administrate::BaseDashboard
87
87
  end
88
88
  ```
89
89
 
90
+ ### direct_upload
91
+ If you want to upload directly from the browser to the cloud you can use direct_upload
92
+ ```ruby
93
+ class ModelDashboard < Administrate::BaseDashboard
94
+ ATTRIBUTE_TYPES = {
95
+ attachments: Field::ActiveStorage.with_options({direct_upload: true}),
96
+ # ...
97
+ }
98
+ # ...
99
+ end
100
+ ```
101
+
102
+ Don't forget to include [ActiveStorage JavaScript](https://edgeguides.rubyonrails.org/active_storage_overview.html#direct-uploads). You can use `rails generate administrate:assets:javascripts` to be able to customize Administrate JavaScripts in your application.
103
+
90
104
  ## Things To Do:
91
105
  - [x] upload single file
92
106
  - [x] adding image support through url_for to support 3rd party cloud storage
@@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "administrate-field-active_storage"
5
- gem.version = "0.1.4"
5
+ gem.version = "0.1.5"
6
6
  gem.authors = ["Hamad AlGhanim"]
7
7
  gem.email = ["hamadyalghanim@gmail.com"]
8
8
  gem.homepage = "https://github.com/Dreamersoul/administrate-field-active_storage"
@@ -26,5 +26,5 @@ By default, the input is a text field for the image's URL.
26
26
  Add:
27
27
  <% end %>
28
28
 
29
- <%= f.file_field field.attribute, multiple: field.many? %>
29
+ <%= f.file_field field.attribute, multiple: field.many?, direct_upload: field.direct? %>
30
30
  </div>
data/contribute.md CHANGED
@@ -3,3 +3,5 @@
3
3
  - Patrick Gleeson [@patrick-gleeson](https://github.com/patrick-gleeson)
4
4
  - Mario Zigliotto [@mariozig](https://github.com/mariozig)
5
5
  - Leif Gensert [@leifg](https://github.com/leifg)
6
+ - Kadu Diógenes [@cerdiogenes](https://github.com/cerdiogenes)
7
+ - Peter Bhat Harkins [@pushcx](https://github.com/pushcx)
@@ -20,6 +20,10 @@ module Administrate
20
20
  data.class.name == "ActiveStorage::Attached::Many"
21
21
  end
22
22
 
23
+ def direct?
24
+ options.fetch(:direct_upload, false)
25
+ end
26
+
23
27
  # def destroy_path?
24
28
  # options.fetch(:destroy_path, false).present?
25
29
  # end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: administrate-field-active_storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hamad AlGhanim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-21 00:00:00.000000000 Z
11
+ date: 2019-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: administrate