motor-admin 0.4.18 → 0.4.19

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: f3a3043b22c41b8cecc31db194e525ececd4f1120b684caac290840262d03abf
4
- data.tar.gz: 2a33a058ea4b2384b78afc0fb0aab1b00f18a19547a8611bd3dad2620faa4e4d
3
+ metadata.gz: a88b2fd0cde6191cd9f88b1df8063d996e8532b309e290f0e963859fbc7faabd
4
+ data.tar.gz: fd40adb2042a35f79781fdc501563031da2d104dc40c87da49a11335083b98d9
5
5
  SHA512:
6
- metadata.gz: 2ab80a1ad495344ce5125d5f7bb065d6b93995463d3174ccdf1045ef6a6f6900f21c05b0b1abff63e4a67f4f9e1d038d1b63884a638516c2a309ff7f8f52683f
7
- data.tar.gz: ea69c3f11a524028fee52cdb7d4902196ee5297a47fdada16e90f26f06b33b80ae12d8dd0c6598023cf599f39b8d8137769adb53e4f2eb9f39e574bc4aa72ec9
6
+ metadata.gz: 6f7782f4087685b746e3c8974b5dcb60feeeb201b848e1816a017e4e825c6efb32170165647e85212346331daaff357e0ab00b68ff8e0aceebd85021ad2b9fd7
7
+ data.tar.gz: da3509a503cbcf673a4ee41c129f3bd51b7a4a6b4247f5c3f07aeabe0ef8ff92d068495d03469cbc29edc111d9f61f721260f8879be86a1002d51cdb4ab5efe9
@@ -9,7 +9,13 @@ module Motor
9
9
  load_and_authorize_resource :attachment, class: 'ActiveStorage::Attachment', parent: false
10
10
 
11
11
  def create
12
- @attachment.assign_attributes(blob: ActiveStorage::Blob.create_and_upload!(file_params), record: record)
12
+ blob = if file_params[:key]
13
+ ActiveStorage::Blob.create!(file_params)
14
+ else
15
+ ActiveStorage::Blob.create_and_upload!(file_params)
16
+ end
17
+
18
+ @attachment.assign_attributes(blob: blob, record: record)
13
19
  @attachment.assign_attributes(record_type: '', record_id: 0) unless record
14
20
 
15
21
  if @attachment.save(validate: false)
@@ -36,12 +42,20 @@ module Motor
36
42
  end
37
43
 
38
44
  def file_params
39
- params.require(:data).require(:file).permit(:io, :filename).to_h.symbolize_keys
45
+ attrs = params.require(:data).require(:file).permit(:io, :filename, :key,
46
+ :checksum, :byte_size,
47
+ :content_type).to_h.symbolize_keys
48
+
49
+ return attrs if params.dig(:data, :file, :base64).blank?
50
+
51
+ attrs[:io] = StringIO.new(Base64.urlsafe_decode64(params[:data][:file][:base64]))
52
+
53
+ attrs
40
54
  end
41
55
 
42
56
  def attachment_params
43
57
  if params[:data].present?
44
- params.require(:data).except(:file).permit!
58
+ params.require(:data).except(:file).permit(:name, :record_type, :record_id)
45
59
  else
46
60
  {}
47
61
  end
data/lib/motor/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Motor
4
- VERSION = '0.4.18'
4
+ VERSION = '0.4.19'
5
5
  end
@@ -3964,9 +3964,9 @@
3964
3964
  "images/layers-2x.png": "images/layers-2x.png",
3965
3965
  "images/layers.png": "images/layers.png",
3966
3966
  "images/marker-icon.png": "images/marker-icon.png",
3967
- "main-17b6af8c481786f31cc4.css.gz": "main-17b6af8c481786f31cc4.css.gz",
3968
- "main-17b6af8c481786f31cc4.js.LICENSE.txt": "main-17b6af8c481786f31cc4.js.LICENSE.txt",
3969
- "main-17b6af8c481786f31cc4.js.gz": "main-17b6af8c481786f31cc4.js.gz",
3970
- "main.css": "main-17b6af8c481786f31cc4.css",
3971
- "main.js": "main-17b6af8c481786f31cc4.js"
3967
+ "main-ef1da0e0e37f4ff4c0bd.css.gz": "main-ef1da0e0e37f4ff4c0bd.css.gz",
3968
+ "main-ef1da0e0e37f4ff4c0bd.js.LICENSE.txt": "main-ef1da0e0e37f4ff4c0bd.js.LICENSE.txt",
3969
+ "main-ef1da0e0e37f4ff4c0bd.js.gz": "main-ef1da0e0e37f4ff4c0bd.js.gz",
3970
+ "main.css": "main-ef1da0e0e37f4ff4c0bd.css",
3971
+ "main.js": "main-ef1da0e0e37f4ff4c0bd.js"
3972
3972
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motor-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.18
4
+ version: 0.4.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Matsyburka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-07 00:00:00.000000000 Z
11
+ date: 2023-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ar_lazy_preload
@@ -2235,8 +2235,8 @@ files:
2235
2235
  - ui/dist/images/layers-2x.png
2236
2236
  - ui/dist/images/layers.png
2237
2237
  - ui/dist/images/marker-icon.png
2238
- - ui/dist/main-17b6af8c481786f31cc4.css.gz
2239
- - ui/dist/main-17b6af8c481786f31cc4.js.gz
2238
+ - ui/dist/main-ef1da0e0e37f4ff4c0bd.css.gz
2239
+ - ui/dist/main-ef1da0e0e37f4ff4c0bd.js.gz
2240
2240
  - ui/dist/manifest.json
2241
2241
  homepage:
2242
2242
  licenses: