motor-admin 0.4.18 → 0.4.20

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: 2b796ea06cac239bc9bbdb96dc4c55360f0ea1f10ef231138b97f45a12922110
4
+ data.tar.gz: 9178090c51a6b08d9a393e9c4b0f3c09733ac96ce9e9bce9c8fb07c1c0ed8c7c
5
5
  SHA512:
6
- metadata.gz: 2ab80a1ad495344ce5125d5f7bb065d6b93995463d3174ccdf1045ef6a6f6900f21c05b0b1abff63e4a67f4f9e1d038d1b63884a638516c2a309ff7f8f52683f
7
- data.tar.gz: ea69c3f11a524028fee52cdb7d4902196ee5297a47fdada16e90f26f06b33b80ae12d8dd0c6598023cf599f39b8d8137769adb53e4f2eb9f39e574bc4aa72ec9
6
+ metadata.gz: 545907a15250c164e46a1fdb9b9da76cfbaf181e1013521ebca2db73c38a63b4490e486929d064e7e5de4a05fa8ed4dfb3664bcd819cfd25af01adabc9b72045
7
+ data.tar.gz: 139ac86931034ee3f93826bd869eb2bb3f4a00c52d3e017875ac8ee512dda47cd8a8c892d703668b205dcd9f730e650041f60cc820d95376ddce024aa0584786
@@ -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.20'
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-7b8275fb2ab269bb5f11.css.gz": "main-7b8275fb2ab269bb5f11.css.gz",
3968
+ "main-7b8275fb2ab269bb5f11.js.LICENSE.txt": "main-7b8275fb2ab269bb5f11.js.LICENSE.txt",
3969
+ "main-7b8275fb2ab269bb5f11.js.gz": "main-7b8275fb2ab269bb5f11.js.gz",
3970
+ "main.css": "main-7b8275fb2ab269bb5f11.css",
3971
+ "main.js": "main-7b8275fb2ab269bb5f11.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.20
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-07-02 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-7b8275fb2ab269bb5f11.css.gz
2239
+ - ui/dist/main-7b8275fb2ab269bb5f11.js.gz
2240
2240
  - ui/dist/manifest.json
2241
2241
  homepage:
2242
2242
  licenses: