motor-admin 0.3.6 → 0.3.9

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: eda6baf4fb621527782a8529725aa8b8d794a95e17739f657d8ce03bc377de65
4
- data.tar.gz: 262bceb177a009a497c84ba318254efe97894d474c98d3fcb3c34d35581d05a9
3
+ metadata.gz: 34b8766028b5a0c018d296d77eceeb52fef2b4aa39a8d5a50acbdc0044c57791
4
+ data.tar.gz: eeeec8761595541d34b0a4ac33aca73f5308b40d11c1fc064de781c0142acdcc
5
5
  SHA512:
6
- metadata.gz: 9b7500eb106243d61258e8c244a62c6a7cf0b70727a2a69c401fd727a49f7922b1d2e0df097e5ac6c5ba5c6ca176fedc95c46dee873b1308cf9445122ce2f7e1
7
- data.tar.gz: 8fdaa674012474e2db6fd95679476aa0ebbf59bfb2d54589e5816d819b4ec6b327c43929a832bccc969b161e90a5efad59246dc68db9e9944c21cac1244b73c9
6
+ metadata.gz: 3f35819099fa89be904b1a20a6ee7b43d3288ae87c41bcb4cb07f32c9c2ed4b6152bc7e5922cf239409e4e0809a8bd55cae311f24341083ebd4767fc07b10db4
7
+ data.tar.gz: 14ffafaba6b7e1ecd404c1250a07f87f09d5da61e920c6f773e0fb78bb65410ad1c23271b48980e37be1f318bba681b6e3131043c7177f65abf59e10c0400ca2
@@ -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.6'
4
+ VERSION = '0.3.9'
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-53a1a9dffc796b4ca695.css.gz": "main-53a1a9dffc796b4ca695.css.gz",
3970
- "main-53a1a9dffc796b4ca695.js.LICENSE.txt": "main-53a1a9dffc796b4ca695.js.LICENSE.txt",
3971
- "main-53a1a9dffc796b4ca695.js.gz": "main-53a1a9dffc796b4ca695.js.gz",
3972
- "main.css": "main-53a1a9dffc796b4ca695.css",
3973
- "main.js": "main-53a1a9dffc796b4ca695.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.6
4
+ version: 0.3.9
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-10 00:00:00.000000000 Z
11
+ date: 2022-08-27 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-53a1a9dffc796b4ca695.css.gz
2209
- - ui/dist/main-53a1a9dffc796b4ca695.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