madmin 3.0.0 → 3.1.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 +4 -4
- data/README.md +13 -0
- data/app/javascript/madmin/application.js +4 -0
- data/app/javascript/madmin/controllers/application.js +0 -3
- data/app/views/madmin/fields/attachment/_form.html.erb +1 -1
- data/app/views/madmin/fields/attachments/_form.html.erb +1 -1
- data/app/views/madmin/fields/file/_form.html.erb +1 -1
- data/config/importmap.rb +0 -2
- data/lib/madmin/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 20136d0b34c7e92205f9a31340bfd80b335df1493163980e6ad261cd5c0a1adf
|
|
4
|
+
data.tar.gz: 1a1d960cb9b48a0bd440a33d36f42007ff68427858cc84048a022bc69fb1ad0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2a854ceb5de31a241a3c780d79e3620942e9b2e854e39e1ad00055bdadc7dbccb7e6d490bde3eea07ea4076edd54f208c05fe660626662381b20b9f370adc3af
|
|
7
|
+
data.tar.gz: fc31f7470dfbff5753fba175ca05f40a66eedfef0ccc62bfabb31b8c4250985716b1fe6d6b20d6b2313409b294dfc2df2287315a08d10a529c7bff255ffcd1d1
|
data/README.md
CHANGED
|
@@ -229,6 +229,19 @@ end
|
|
|
229
229
|
|
|
230
230
|
A nested has one shows its fields when the record exists, or an "Add" link when it doesn't, so saving the parent doesn't create an empty record.
|
|
231
231
|
|
|
232
|
+
### Direct Uploads
|
|
233
|
+
|
|
234
|
+
File fields upload through the form by default. Add `direct_upload: true` to upload straight from the browser to your Active Storage service instead, which keeps large files off your app servers and avoids request timeouts:
|
|
235
|
+
|
|
236
|
+
```ruby
|
|
237
|
+
class PostResource < Madmin::Resource
|
|
238
|
+
attribute :image, direct_upload: true
|
|
239
|
+
attribute :attachments, direct_upload: true
|
|
240
|
+
end
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Cloud services like S3 need CORS configured to accept uploads from the browser. See the [Active Storage guide](https://guides.rubyonrails.org/active_storage_overview.html#cross-origin-resource-sharing-cors-configuration).
|
|
244
|
+
|
|
232
245
|
## Custom Fields
|
|
233
246
|
|
|
234
247
|
You can generate a custom field with:
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import "@hotwired/turbo-rails"
|
|
2
2
|
import "@rails/actiontext"
|
|
3
|
+
import * as ActiveStorage from "@rails/activestorage"
|
|
3
4
|
import "controllers"
|
|
5
|
+
|
|
6
|
+
// Uploads files straight to storage for fields with `direct_upload: true`. Other file fields submit with the form
|
|
7
|
+
ActiveStorage.start()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%= form.file_field field.attribute_name, multiple: true, class: "form-input" %>
|
|
1
|
+
<%= form.file_field field.attribute_name, multiple: true, direct_upload: field.options.direct_upload, class: "form-input" %>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%= form.file_field field.attribute_name, class: "form-input" %>
|
|
1
|
+
<%= form.file_field field.attribute_name, direct_upload: field.options.direct_upload, class: "form-input" %>
|
data/config/importmap.rb
CHANGED
|
@@ -10,5 +10,3 @@ pin "lexxy", to: "lexxy.js" if defined?(::Lexxy)
|
|
|
10
10
|
|
|
11
11
|
pin_all_from Madmin::Engine.root.join("app/javascript/madmin/controllers"), under: "controllers", to: "madmin/controllers"
|
|
12
12
|
pin_all_from Rails.root.join("app/javascript/madmin/controllers"), under: "controllers", to: "madmin/controllers"
|
|
13
|
-
|
|
14
|
-
pin "tailwindcss-stimulus-components", to: "https://ga.jspm.io/npm:tailwindcss-stimulus-components@6.1.2/dist/tailwindcss-stimulus-components.module.js"
|
data/lib/madmin/version.rb
CHANGED