motor-admin 0.3.7 → 0.3.10

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: 799c312697a76fa05e0d649406b74a91813667cdd49a4e2cb4b1639764f31916
4
- data.tar.gz: 8a6e60ee5510a4fc00dd48384e1ee99cbd845e7b7c8365702e76e1d22c05bdae
3
+ metadata.gz: f4d2d0831f0cf45e8cccfeaff5cdb7710f36f8f22be28d24b26dd79cda65955a
4
+ data.tar.gz: 024dc7ac23622a17671d27cb69246242195c3e5bfbd758fea48d9d38df77cf1e
5
5
  SHA512:
6
- metadata.gz: 505f0fe67aeef3c9292b0f100646c05ea06f728eac8062b6c5f52acba441402d7f62f94b692c608202d3594d1e0a5d92b2d0087fc33674202b4d725843ceeb1c
7
- data.tar.gz: 20b5d845816c08787beb5625d36739f730e2e8d6e3fceca8c0ec3e892944fdd5626e2612981a0d7686013264d56ce24e4c55fac18be498ef71423e750ca249fc
6
+ metadata.gz: cc3931e9d9e70515e98a3acdf47330a7a82c7084f703461e360c083e1ec044f65d1ff160064c9bf7297cd959e8fdd9d4d8d4c6b84fc00bde9caad41264cc0b39
7
+ data.tar.gz: 322e8d603f75e61ff485ca24b10e335490fbec0d679dde983d0df089cd97747b60e4355604794bea8008071ec442018f5de2931ae46d2c9d4532ce99c56f5726
@@ -4,12 +4,12 @@ module Motor
4
4
  class ApiConfig < ::Motor::ApplicationRecord
5
5
  encrypts :credentials if defined?(::Motor::EncryptedConfig)
6
6
 
7
- serialize :credentials, Motor::HashSerializer
8
- serialize :preferences, Motor::HashSerializer
9
-
10
7
  attribute :preferences, default: -> { HashWithIndifferentAccess.new }
11
8
  attribute :credentials, default: -> { HashWithIndifferentAccess.new }
12
9
 
10
+ serialize :credentials, Motor::HashSerializer
11
+ serialize :preferences, Motor::HashSerializer
12
+
13
13
  has_one :form, dependent: nil, foreign_key: :api_config_name, primary_key: :name, inverse_of: :api_config
14
14
 
15
15
  scope :active, -> { where(deleted_at: nil) }
@@ -55,7 +55,12 @@ module ActiveRecord
55
55
  end
56
56
 
57
57
  def aliased_table_for_relation(trail, arel_table, &block)
58
- @relation_trail[trail] ||= aliased_table_for(arel_table, &block)
58
+ @relation_trail[trail] ||=
59
+ if Rails::VERSION::MAJOR >= 6
60
+ aliased_table_for(arel_table, &block)
61
+ else
62
+ aliased_table_for(arel_table.name, trail.last, nil)
63
+ end
59
64
  end
60
65
  end
61
66
  end
@@ -210,7 +215,7 @@ module ActiveRecord
210
215
  end
211
216
 
212
217
  def expand_filter_for_column(key, column, value, relation_trail)
213
- attribute = table.arel_table[column.name]
218
+ attribute = table.send(:arel_table)[column.name]
214
219
  relation_trail.each do |rt|
215
220
  attribute = Arel::Attributes::Relation.new(attribute, rt)
216
221
  end
@@ -5,7 +5,7 @@ module Motor
5
5
  module ActiveStorageAttachmentSchema
6
6
  module_function
7
7
 
8
- # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
8
+ # rubocop:disable Metrics/MethodLength
9
9
  def call
10
10
  model = ActiveStorage::Attachment
11
11
 
@@ -119,7 +119,7 @@ module Motor
119
119
  visible: false
120
120
  }.with_indifferent_access
121
121
  end
122
- # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
122
+ # rubocop:enable Metrics/MethodLength
123
123
  end
124
124
  end
125
125
  end
@@ -256,7 +256,6 @@ module Motor
256
256
  }
257
257
  end
258
258
 
259
- # rubocop:disable Metrics/AbcSize
260
259
  def fetch_associations(model)
261
260
  model.reflections.map do |name, ref|
262
261
  next if ref.has_one? || ref.belongs_to?
@@ -281,7 +280,6 @@ module Motor
281
280
  }
282
281
  end.compact
283
282
  end
284
- # rubocop:enable Metrics/AbcSize
285
283
 
286
284
  def fetch_validators(model, column_name, reflection = nil)
287
285
  validators =
@@ -5,7 +5,6 @@ module Motor
5
5
  module BuildConfigsHash
6
6
  module_function
7
7
 
8
- # rubocop:disable Metrics/AbcSize
9
8
  def call
10
9
  cache_keys = LoadFromCache.load_cache_keys
11
10
 
@@ -21,7 +20,6 @@ module Motor
21
20
  api_configs: build_api_configs_hash(cache_keys[:api_configs])
22
21
  )
23
22
  end
24
- # rubocop:enable Metrics/AbcSize
25
23
 
26
24
  def build_queries_hash(cache_key = nil)
27
25
  Motor::Configs::LoadFromCache.load_queries(cache_key: cache_key).sort_by(&:id).map do |query|
@@ -95,7 +95,6 @@ module Motor
95
95
  end
96
96
  end
97
97
 
98
- # rubocop:disable Metrics/AbcSize
99
98
  def sync_resources(configs_hash)
100
99
  resources_index = Motor::Configs::LoadFromCache.load_resources.index_by(&:name)
101
100
 
@@ -113,7 +112,6 @@ module Motor
113
112
 
114
113
  ActiveRecordUtils.reset_id_sequence!(Motor::Resource)
115
114
  end
116
- # rubocop:enable Metrics/AbcSize
117
115
 
118
116
  def sync_taggable(records, config_items, configs_timestamp, update_proc)
119
117
  processed_records, create_items = update_taggable_items(records, config_items, update_proc)
@@ -140,18 +140,18 @@ module Motor
140
140
  end
141
141
 
142
142
  def define_has_one_reflection(klass, config)
143
- options = {
144
- class_name: config[:model_name].classify,
145
- foreign_key: config[:foreign_key],
146
- primary_key: config[:primary_key]
147
- }
148
-
149
- options = options.merge(config[:options] || {})
150
-
151
143
  if config[:model_name] == 'active_storage/attachment'
152
- klass.has_one_attached config[:name].delete_suffix('_attachment').to_sym
144
+ klass.has_one_attached(config[:name].delete_suffix('_attachment').to_sym)
153
145
  else
154
- klass.has_one(config[:name].to_sym, **options.symbolize_keys)
146
+ options = {
147
+ **klass.reflections[config[:name]]&.options.to_h,
148
+ class_name: config[:model_name].classify,
149
+ foreign_key: config[:foreign_key],
150
+ primary_key: config[:primary_key],
151
+ **config[:options].to_h
152
+ }.symbolize_keys
153
+
154
+ klass.has_one(config[:name].to_sym, **options)
155
155
  end
156
156
  end
157
157
 
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.3.7'
4
+ VERSION = '0.3.10'
5
5
  end
@@ -3963,12 +3963,10 @@
3963
3963
  "icons/zoom-question.svg.gz": "icons/zoom-question.svg.gz",
3964
3964
  "images/layers-2x.png": "images/layers-2x.png",
3965
3965
  "images/layers.png": "images/layers.png",
3966
- "images/marker-icon-2x.png": "images/marker-icon-2x.png",
3967
3966
  "images/marker-icon.png": "images/marker-icon.png",
3968
- "images/marker-shadow.png": "images/marker-shadow.png",
3969
- "main-5d47c86ba29167bd4fab.css.gz": "main-5d47c86ba29167bd4fab.css.gz",
3970
- "main-5d47c86ba29167bd4fab.js.LICENSE.txt": "main-5d47c86ba29167bd4fab.js.LICENSE.txt",
3971
- "main-5d47c86ba29167bd4fab.js.gz": "main-5d47c86ba29167bd4fab.js.gz",
3972
- "main.css": "main-5d47c86ba29167bd4fab.css",
3973
- "main.js": "main-5d47c86ba29167bd4fab.js"
3967
+ "main-6c26686ed04da32a0e42.css.gz": "main-6c26686ed04da32a0e42.css.gz",
3968
+ "main-6c26686ed04da32a0e42.js.LICENSE.txt": "main-6c26686ed04da32a0e42.js.LICENSE.txt",
3969
+ "main-6c26686ed04da32a0e42.js.gz": "main-6c26686ed04da32a0e42.js.gz",
3970
+ "main.css": "main-6c26686ed04da32a0e42.css",
3971
+ "main.js": "main-6c26686ed04da32a0e42.js"
3974
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.3.7
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Matsyburka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-12 00:00:00.000000000 Z
11
+ date: 2022-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ar_lazy_preload
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '6.0'
75
+ version: '5.2'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '6.0'
82
+ version: '5.2'
83
83
  description: |
84
84
  Motor Admin allows to create a flexible admin panel with writing less code.
85
85
  All customizations to the admin panel can be made directly in the UI without
@@ -2202,11 +2202,9 @@ files:
2202
2202
  - ui/dist/icons/zoom-question.svg.gz
2203
2203
  - ui/dist/images/layers-2x.png
2204
2204
  - ui/dist/images/layers.png
2205
- - ui/dist/images/marker-icon-2x.png
2206
2205
  - ui/dist/images/marker-icon.png
2207
- - ui/dist/images/marker-shadow.png
2208
- - ui/dist/main-5d47c86ba29167bd4fab.css.gz
2209
- - ui/dist/main-5d47c86ba29167bd4fab.js.gz
2206
+ - ui/dist/main-6c26686ed04da32a0e42.css.gz
2207
+ - ui/dist/main-6c26686ed04da32a0e42.js.gz
2210
2208
  - ui/dist/manifest.json
2211
2209
  homepage:
2212
2210
  licenses:
Binary file
Binary file