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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 502a8cbe4b6c86b1fa6f45d2f4d0f1f5b7852b48805a8d980cfb177ed4151c51
4
- data.tar.gz: 41d8fbfd222f0758f81e2b90762d54ddbefd279ebd18b455ac2def6bd2a60e1e
3
+ metadata.gz: 20136d0b34c7e92205f9a31340bfd80b335df1493163980e6ad261cd5c0a1adf
4
+ data.tar.gz: 1a1d960cb9b48a0bd440a33d36f42007ff68427858cc84048a022bc69fb1ad0e
5
5
  SHA512:
6
- metadata.gz: c390c0a27fcfe25bee8b1ab32f7d53644cc68cad9ee386f17adf810839a511212dfa7fe821cf275edd63a95d1dccbdbeffb22bad56f1ffa5db6c0e67e56d3a74
7
- data.tar.gz: be7ec1e7fa71db380147c44f154e539e56719b35be488f7068473dfccfeeba44175abb58ee281bf4eb1089ab8a188eb5b66c0e5d46d847f639f1bbe15895107d
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()
@@ -7,6 +7,3 @@ application.debug = false
7
7
  window.Stimulus = application
8
8
 
9
9
  export { application }
10
-
11
- import { Dropdown } from "tailwindcss-stimulus-components"
12
- application.register("dropdown", Dropdown)
@@ -1,4 +1,4 @@
1
- <%= form.file_field field.to_param, class: "form-input"%>
1
+ <%= form.file_field field.to_param, direct_upload: field.options.direct_upload, class: "form-input" %>
2
2
 
3
3
  <% if form.object.persisted? %>
4
4
  <div class="mt-2">
@@ -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"
@@ -1,3 +1,3 @@
1
1
  module Madmin
2
- VERSION = "3.0.0"
2
+ VERSION = "3.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: madmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver