motor-admin-pz 0.4.14 → 0.4.21

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: 7282bce61c2e6ad8077646d5dd96a6661373aa1d043326112e2b1e5594075b27
4
- data.tar.gz: 663e4577ea9b4bee7b6bbfb87b03e5d8ad53fd452369e4d9b82bbb878eb589ec
3
+ metadata.gz: 01224f114847f19ba5c8e9e07a27727513054bf72b47202df20f705f1cf77078
4
+ data.tar.gz: 3485e39fab2541a58048658ffa471148063854c666a27cdcb5023cdaac566ce6
5
5
  SHA512:
6
- metadata.gz: 6a58afef22864f096700d213e9b40b527f8cf912927c663d80f8f5700707a7ca0a51832e03391030042ad8befd9025b56112fc3763c7ea6f83e8ec1857e42cd3
7
- data.tar.gz: b0791907247f0eb2be14acd95a5c96d4597f866b95761082b26d27f248c9f94f040523e9ebe3ffee5459ab016421aaf062a5e72a46268798e9e091f58efd26ac
6
+ metadata.gz: 4759c92b2dc52ffffdf8420be7639bb3ef42eb2fad5d9b259505dcb6f3b8fe2453780070602da33156a42663555465c40b9db81926251f5ea3a868c472cfa8ef
7
+ data.tar.gz: 67cfb0fb8d5e52297d0aaabca6b89ffccfd336cc1ce4d60e60b658b5718d6571544ed62dee1ce2dc038e402ea81b327bd213df6bdeefd4cd69c7b604ec230480
@@ -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
@@ -24,6 +24,8 @@ module Motor
24
24
  params: request_params[:params],
25
25
  headers: { 'Authorization' => "Bearer #{current_user_jwt}" })
26
26
 
27
+ response.to_hash.each { |key, (value)| headers[key] = value }
28
+
27
29
  self.response_body = response.body
28
30
  self.status = response.code.to_i
29
31
  end
@@ -18,6 +18,8 @@ module Motor
18
18
  variables: request_params[:variables],
19
19
  headers: { 'Authorization' => "Bearer #{current_user_jwt}" })
20
20
 
21
+ response.to_hash.each { |key, (value)| headers[key] = value }
22
+
21
23
  self.response_body = response.body
22
24
  self.status = response.code.to_i
23
25
  end
@@ -165,6 +165,9 @@ class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Mi
165
165
 
166
166
  t.timestamps
167
167
 
168
+ t.index %i[record_id record_type],
169
+ name: 'motor_notes_record_id_record_type_index'
170
+
168
171
  t.index %i[author_id author_type],
169
172
  name: 'motor_notes_author_id_author_type_index'
170
173
  end
data/lib/motor/admin.rb CHANGED
@@ -4,7 +4,7 @@ module Motor
4
4
  class Admin < ::Rails::Engine
5
5
  config.custom_html = ''
6
6
 
7
- if !Motor.development? && !Rails.env.production?
7
+ if !Motor.development? && Rails.env.development?
8
8
  config.eager_load_paths.delete(File.expand_path('../../app/controllers', __dir__))
9
9
  config.eager_load_paths.delete(File.expand_path('../../app/controllers/concerns', __dir__))
10
10
  config.eager_load_paths.delete(File.expand_path('../../app/models', __dir__))
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.14'
4
+ VERSION = '0.4.21'
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-f13bee99553647ee67f8.css.gz": "main-f13bee99553647ee67f8.css.gz",
3968
- "main-f13bee99553647ee67f8.js.LICENSE.txt": "main-f13bee99553647ee67f8.js.LICENSE.txt",
3969
- "main-f13bee99553647ee67f8.js.gz": "main-f13bee99553647ee67f8.js.gz",
3970
- "main.css": "main-f13bee99553647ee67f8.css",
3971
- "main.js": "main-f13bee99553647ee67f8.js"
3967
+ "main-ff9162d64f6a9764f3a2.css.gz": "main-ff9162d64f6a9764f3a2.css.gz",
3968
+ "main-ff9162d64f6a9764f3a2.js.LICENSE.txt": "main-ff9162d64f6a9764f3a2.js.LICENSE.txt",
3969
+ "main-ff9162d64f6a9764f3a2.js.gz": "main-ff9162d64f6a9764f3a2.js.gz",
3970
+ "main.css": "main-ff9162d64f6a9764f3a2.css",
3971
+ "main.js": "main-ff9162d64f6a9764f3a2.js"
3972
3972
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motor-admin-pz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.14
4
+ version: 0.4.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Matsyburka
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-04-26 00:00:00.000000000 Z
12
+ date: 2023-09-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ar_lazy_preload
@@ -2239,8 +2239,8 @@ files:
2239
2239
  - ui/dist/images/layers-2x.png
2240
2240
  - ui/dist/images/layers.png
2241
2241
  - ui/dist/images/marker-icon.png
2242
- - ui/dist/main-f13bee99553647ee67f8.css.gz
2243
- - ui/dist/main-f13bee99553647ee67f8.js.gz
2242
+ - ui/dist/main-ff9162d64f6a9764f3a2.css.gz
2243
+ - ui/dist/main-ff9162d64f6a9764f3a2.js.gz
2244
2244
  - ui/dist/manifest.json
2245
2245
  homepage:
2246
2246
  licenses: