motor-admin 0.2.39 → 0.2.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e3ce846e29191c7486d32cd8fb4e06596d73e11d46e8d34d93094c6407c9efa
4
- data.tar.gz: 6b875912c05b215c6a7407b64658d51ed2d035925a4816ef8d5c50e3cbe59a59
3
+ metadata.gz: a51c13e10df9707cb2130c580660133d07a543c55e97157ebe8660099ff602e6
4
+ data.tar.gz: 81a887350a6fec48cae6fa7c0d74d1efaae29456685e7d2bb63d8347d6aab7e4
5
5
  SHA512:
6
- metadata.gz: d5ec9f6d2f97ac583f17b1948c9488f7df31a2b6e85789d2f8877d623c8d9a2403712dde886ff4855061661f9f8af431619727693175d7da05753ba3dd2bbbe1
7
- data.tar.gz: 6737e74641f4ae7fb60845757f8741bbb082a001f44bf0933c8795157f76b513462e3e38d36de04229e8a5bc16dfbd9217a50ddda70752b223503a367405902e
6
+ metadata.gz: f9d5172d6d3014145c39f3640def2f7dbedf4b79dd0c2021562933d6da5caff0430f95334a30cb8c3fed6afa884753d1bd268cf28f8171fe9e03fc3d755d1049
7
+ data.tar.gz: 8a56bce2407c3314d41ecb5d977e275da6b36fd40ac41468912ded8d02b386f3af27b4410e1be0e6c4b4c6b99736239326c663f4aadac4b9f5e30c5bcf30c2f3
@@ -293,3 +293,6 @@ en:
293
293
  regexp: RegExp
294
294
  message: Message
295
295
  should_be_a_valid_regexp: Should be a valid RegExp string
296
+ order_by: Order by
297
+ ascending: Ascending
298
+ descending: Descending
@@ -293,6 +293,9 @@ es:
293
293
  regexp: RegExp
294
294
  message: Mensaje
295
295
  should_be_a_valid_regexp: Debe ser una cadena RegExp válida
296
+ order_by: Ordenar por
297
+ ascending: Ascendente
298
+ descending: Descendente
296
299
  i:
297
300
  locale: es
298
301
  select:
@@ -289,6 +289,9 @@ pt:
289
289
  regexp: RegExp
290
290
  message: Mensagem
291
291
  should_be_a_valid_regexp: Deve ser uma string RegExp válida
292
+ order_by: Encomendar por
293
+ ascending: Ascendente
294
+ descending: Decrescente
292
295
  i:
293
296
  locale: pt
294
297
  select:
@@ -26,7 +26,17 @@ module Motor
26
26
 
27
27
  return rel unless scope_configs
28
28
 
29
- ApiQuery::Filter.call(rel, scope_configs[:preferences][:filter])
29
+ rel = ApiQuery::Filter.call(rel, scope_configs[:preferences][:filter])
30
+
31
+ apply_order(rel, scope_configs[:preferences][:sort])
32
+ end
33
+
34
+ def apply_order(rel, params)
35
+ return rel if params.blank?
36
+
37
+ sort_key, sort_order = params.values_at(:key, :order)
38
+
39
+ rel.order(sort_key => sort_order)
30
40
  end
31
41
  end
32
42
  end
@@ -194,7 +194,9 @@ module Motor
194
194
  def normalize_statement_for_sql(statement)
195
195
  sql, _, attributes = statement
196
196
 
197
- sql = ActiveRecord::Base.sanitize_sql([sql.gsub(STATEMENT_VARIABLE_REGEXP, '?'), attributes.map(&:value)])
197
+ sql = ActiveRecord::Base.send(:replace_bind_variables,
198
+ sql.gsub(STATEMENT_VARIABLE_REGEXP, '?'),
199
+ attributes.map(&:value))
198
200
 
199
201
  [sql, 'SQL', attributes]
200
202
  end
@@ -41,7 +41,7 @@ module Motor
41
41
  def define_default_scope(klass, config)
42
42
  return klass if config[:custom_sql].blank?
43
43
 
44
- klass.instance_variable_set(:@__motor_custom_sql, config[:custom_sql].squish)
44
+ klass.instance_variable_set(:@__motor_custom_sql, config[:custom_sql].squish.delete_suffix(';'))
45
45
 
46
46
  klass.instance_eval do
47
47
  default_scope do
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.2.39'
4
+ VERSION = '0.2.41'
5
5
  end
@@ -2601,9 +2601,9 @@
2601
2601
  "icons/zoom-out.svg.gz": "icons/zoom-out.svg.gz",
2602
2602
  "icons/zoom-question.svg": "icons/zoom-question.svg",
2603
2603
  "icons/zoom-question.svg.gz": "icons/zoom-question.svg.gz",
2604
- "main-01a5fc164f7a205535b6.css.gz": "main-01a5fc164f7a205535b6.css.gz",
2605
- "main-01a5fc164f7a205535b6.js.LICENSE.txt": "main-01a5fc164f7a205535b6.js.LICENSE.txt",
2606
- "main-01a5fc164f7a205535b6.js.gz": "main-01a5fc164f7a205535b6.js.gz",
2607
- "main.css": "main-01a5fc164f7a205535b6.css",
2608
- "main.js": "main-01a5fc164f7a205535b6.js"
2604
+ "main-f7a83db6d8381e2638a1.css.gz": "main-f7a83db6d8381e2638a1.css.gz",
2605
+ "main-f7a83db6d8381e2638a1.js.LICENSE.txt": "main-f7a83db6d8381e2638a1.js.LICENSE.txt",
2606
+ "main-f7a83db6d8381e2638a1.js.gz": "main-f7a83db6d8381e2638a1.js.gz",
2607
+ "main.css": "main-f7a83db6d8381e2638a1.css",
2608
+ "main.js": "main-f7a83db6d8381e2638a1.js"
2609
2609
  }
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.2.39
4
+ version: 0.2.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Matsyburka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-20 00:00:00.000000000 Z
11
+ date: 2021-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord-filter
@@ -1526,8 +1526,8 @@ files:
1526
1526
  - ui/dist/icons/zoom-money.svg.gz
1527
1527
  - ui/dist/icons/zoom-out.svg.gz
1528
1528
  - ui/dist/icons/zoom-question.svg.gz
1529
- - ui/dist/main-01a5fc164f7a205535b6.css.gz
1530
- - ui/dist/main-01a5fc164f7a205535b6.js.gz
1529
+ - ui/dist/main-f7a83db6d8381e2638a1.css.gz
1530
+ - ui/dist/main-f7a83db6d8381e2638a1.js.gz
1531
1531
  - ui/dist/manifest.json
1532
1532
  homepage:
1533
1533
  licenses: