motor-admin 0.3.5 → 0.3.8

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: ce4fa10d33b3f41a5a0ba509b53d7815631c1980b521839ecc51f7f80ed548aa
4
- data.tar.gz: 35d3b13d657714f909ab7fc56f088fc3270b0e40e1839aadc5cf227c99e78fc2
3
+ metadata.gz: 1ff52913a60cfabf145dad356facf20ddcd67a5d34d301805b00f035892f004f
4
+ data.tar.gz: 578f5f5f276856d55b9011347c5e6fe3277f8aac7827a5e919d7d87ecc6e23f9
5
5
  SHA512:
6
- metadata.gz: b6c79c98ff08d7402cfc54ff91c661616f2b87bced25af12ff0637a99327fdb000455e9bd32fd78ffe611e3007acfd01104f74b39f5318a1dcdf2798151db733
7
- data.tar.gz: ba7f58cfd0500b1aa6b9f7b7659afd718f05b548da8597384cc2d036b08c1d4a54c5aa291ddb05b9ebda05cb65bdf08d3bc19e6c6d553d9ab12b3bb0b12dd437
6
+ metadata.gz: d3611e7b266ee6c5f69543e6de1ea6ca9ed6aa420d7f355d3289a7cbf52c2568aec5941b98043dbc9d1ae7ce12aced943aca8bc04a95c6e67950879622ec83ff
7
+ data.tar.gz: b77573c1149ca48d113640a31ecfb979f46e71ae5625e2f584c2a6a2c31197d81be3a7cc73136a558903c043adca3a2f2f9d990db0fe69fd7fb130c289c70aa3
@@ -5,14 +5,44 @@ module ActiveRecord
5
5
  end
6
6
  end
7
7
 
8
- ActiveRecord::QueryMethods.module_eval do
9
- def build_arel_with_distinct_on(aliases = nil)
10
- arel = build_arel_without_distinct_on(aliases)
11
- arel.distinct_on(distinct_on_values) unless distinct_on_values.empty?
12
- arel
8
+ module Arel
9
+ module Attributes
10
+ class Relation < Attribute
11
+ attr_accessor :collection, :for_write
12
+
13
+ def initialize(relation, name, collection = false, for_write = false)
14
+ self[:relation] = relation
15
+ self[:name] = name
16
+ @collection = collection
17
+ @for_write = for_write
18
+ end
19
+
20
+ delegate :able_to_type_cast?, to: :relation
21
+
22
+ def table_name
23
+ nil
24
+ end
25
+
26
+ def eql?(other)
27
+ self.class == other.class &&
28
+ relation == other.relation &&
29
+ name == other.name &&
30
+ collection == other.collection
31
+ end
32
+
33
+ delegate :type_cast_for_database, to: :relation
34
+ end
13
35
  end
36
+ end
14
37
 
15
- alias_method :build_arel, :build_arel_with_distinct_on
38
+ module Arel
39
+ module Visitors
40
+ class ToSql
41
+ def visit_Arel_Attributes_Relation(o, collector)
42
+ visit(o.relation, collector)
43
+ end
44
+ end
45
+ end
16
46
  end
17
47
 
18
48
  module ActiveRecord
@@ -64,29 +94,30 @@ module ActiveRecord
64
94
  end
65
95
  elsif reflection = klass._reflections[key.to_s]
66
96
  if value.is_a?(Hash)
67
- relations << if reflection.polymorphic?
68
- value = value.dup
69
- join_klass = value.delete(:as).safe_constantize
70
- right_table = join_klass.arel_table
71
- left_table = reflection.active_record.arel_table
72
-
73
- on = right_table[join_klass.primary_key]
74
- .eq(left_table[reflection.foreign_key])
75
- .and(left_table[reflection.foreign_type].eq(join_klass.name))
76
-
77
- cross_boundry_joins = join_klass.left_outer_joins(ActiveRecord::PredicateBuilder.filter_joins(join_klass, value).flatten).send(
78
- :build_joins, []
79
- )
80
-
81
- [
82
- left_table.join(right_table, Arel::Nodes::OuterJoin).on(on).join_sources,
83
- cross_boundry_joins
84
- ]
85
- else
86
- {
87
- key => build_filter_joins(reflection.klass, value, [], custom)
88
- }
89
- end
97
+ relations <<
98
+ if reflection.polymorphic?
99
+ value = value.dup
100
+ join_klass = value.delete(:as).safe_constantize
101
+ right_table = join_klass.arel_table
102
+ left_table = reflection.active_record.arel_table
103
+
104
+ on = right_table[join_klass.primary_key]
105
+ .eq(left_table[reflection.foreign_key])
106
+ .and(left_table[reflection.foreign_type].eq(join_klass.name))
107
+
108
+ cross_boundry_joins = join_klass.left_outer_joins(ActiveRecord::PredicateBuilder.filter_joins(join_klass, value).flatten).send(
109
+ :build_joins, []
110
+ )
111
+
112
+ [
113
+ left_table.join(right_table, Arel::Nodes::OuterJoin).on(on).join_sources,
114
+ cross_boundry_joins
115
+ ]
116
+ else
117
+ {
118
+ key => build_filter_joins(reflection.klass, value, [], custom)
119
+ }
120
+ end
90
121
  elsif value.is_a?(Array)
91
122
  value.each do |v|
92
123
  relations << {
@@ -233,37 +264,6 @@ module ActiveRecord
233
264
  attribute.has_any_key(*Array(value).map { |x| Arel::Nodes.build_quoted(x) })
234
265
  when :in
235
266
  attribute.in(value)
236
- when :intersects
237
- # geometry_value = if value.is_a?(Hash) # GeoJSON
238
- # Arel::Nodes::NamedFunction.new('ST_GeomFromGeoJSON', [JSON.generate(value)])
239
- # elsif # EWKB
240
- # elsif # WKB
241
- # elsif # EWKT
242
- # elsif # WKT
243
- # end
244
-
245
- # TODO: us above if to determin if SRID sent
246
- geometry_value = if value.is_a?(Hash)
247
- Arel::Nodes::NamedFunction.new('ST_SetSRID',
248
- [
249
- Arel::Nodes::NamedFunction.new('ST_GeomFromGeoJSON',
250
- [Arel::Nodes.build_quoted(JSON.generate(subvalue))]), 4326
251
- ])
252
- elsif value[0, 1] == "\x00" || value[0, 1] == "\x01" || value[0, 4] =~ /[0-9a-fA-F]{4}/
253
- Arel::Nodes::NamedFunction.new('ST_SetSRID',
254
- [
255
- Arel::Nodes::NamedFunction.new('ST_GeomFromEWKB',
256
- [Arel::Nodes.build_quoted(subvalue)]), 4326
257
- ])
258
- else
259
- Arel::Nodes::NamedFunction.new('ST_SetSRID',
260
- [
261
- Arel::Nodes::NamedFunction.new('ST_GeomFromText',
262
- [Arel::Nodes.build_quoted(subvalue)]), 4326
263
- ])
264
- end
265
-
266
- Arel::Nodes::NamedFunction.new('ST_Intersects', [attribute, geometry_value])
267
267
  when :less_than, :lt
268
268
  attribute.lt(value)
269
269
  when :less_than_or_equal_to, :lteq, :lte
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.5'
4
+ VERSION = '0.3.8'
5
5
  end
data/lib/motor.rb CHANGED
@@ -10,7 +10,6 @@ require 'audited'
10
10
  require 'uri'
11
11
  require 'net/http'
12
12
  require 'net/https'
13
- require 'arel/extensions'
14
13
 
15
14
  module Motor
16
15
  PATH = Pathname.new(__dir__)
@@ -3966,9 +3966,9 @@
3966
3966
  "images/marker-icon-2x.png": "images/marker-icon-2x.png",
3967
3967
  "images/marker-icon.png": "images/marker-icon.png",
3968
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"
3969
+ "main-51ca7a4e6d0745da1aa5.css.gz": "main-51ca7a4e6d0745da1aa5.css.gz",
3970
+ "main-51ca7a4e6d0745da1aa5.js.LICENSE.txt": "main-51ca7a4e6d0745da1aa5.js.LICENSE.txt",
3971
+ "main-51ca7a4e6d0745da1aa5.js.gz": "main-51ca7a4e6d0745da1aa5.js.gz",
3972
+ "main.css": "main-51ca7a4e6d0745da1aa5.css",
3973
+ "main.js": "main-51ca7a4e6d0745da1aa5.js"
3974
3974
  }
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motor-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.8
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-09 00:00:00.000000000 Z
11
+ date: 2022-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: arel-extensions
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '6.0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '6.0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: ar_lazy_preload
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +72,14 @@ dependencies:
86
72
  requirements:
87
73
  - - ">="
88
74
  - !ruby/object:Gem::Version
89
- version: '6.0'
75
+ version: '5.2'
90
76
  type: :runtime
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
80
  - - ">="
95
81
  - !ruby/object:Gem::Version
96
- version: '6.0'
82
+ version: '5.2'
97
83
  description: |
98
84
  Motor Admin allows to create a flexible admin panel with writing less code.
99
85
  All customizations to the admin panel can be made directly in the UI without
@@ -2219,8 +2205,8 @@ files:
2219
2205
  - ui/dist/images/marker-icon-2x.png
2220
2206
  - ui/dist/images/marker-icon.png
2221
2207
  - ui/dist/images/marker-shadow.png
2222
- - ui/dist/main-53a1a9dffc796b4ca695.css.gz
2223
- - ui/dist/main-53a1a9dffc796b4ca695.js.gz
2208
+ - ui/dist/main-51ca7a4e6d0745da1aa5.css.gz
2209
+ - ui/dist/main-51ca7a4e6d0745da1aa5.js.gz
2224
2210
  - ui/dist/manifest.json
2225
2211
  homepage:
2226
2212
  licenses: