forest_admin_datasource_active_record 1.0.0.pre.beta.44 → 1.0.0.pre.beta.46

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: d1553e448b64c5549fb555f2f7eb726bbbb4f2b40fbab5c8a84591db7a075711
4
- data.tar.gz: b7a9ba8472bc93ae67ca375916ecc26c7b66fce00282ee705d7d5e457c122dab
3
+ metadata.gz: 07a8bdd2af59c3debde1fb639ed93c2542f62b7e73dcb8ad5569a68754a21ee7
4
+ data.tar.gz: 22a913eb8b04ff9304f4b60c56c41df3b2128d8481c195d4f05c3445009bfb61
5
5
  SHA512:
6
- metadata.gz: 01ea9c2f84df2d5a8a373833eb1c46789f0fbffcfb85c71b059f92cd216284046ad709d283512e9ed6753d85c93bafb639f03b144407c70e6bcc7197ef7072bf
7
- data.tar.gz: 59616b6c3b49d96521f5945bad8f5690bfc2e878b3e8d0880f5860b96ab5065bee3e47567f5cdc1a375d233e04b43a713d29741d47c74a124f3f1ac9e2dec009
6
+ metadata.gz: 2b8af0ebb35899c9035fe42bb808aa1183098dde0a43751628a0c05c169384643065c084b4d2ca6c7b7699fece8b3861b2eafd76bfb681e8db70b7ac1a37ba80
7
+ data.tar.gz: f1c7d6d3c100fcdeff9bd7a581da5965700504a4431388fb77f7b9325058df9461513023f8d67b3e97ed99cb984dcfd8c1ab66aebdb6a99292b19f47160379cb
@@ -21,6 +21,16 @@ module ForestAdminDatasourceActiveRecord
21
21
  def apply_filter
22
22
  @query = apply_condition_tree(@filter.condition_tree) unless @filter.condition_tree.nil?
23
23
  @query = apply_pagination(@filter.page) unless @filter.page.nil?
24
+ @query = apply_sort(@filter.sort) unless @filter.sort.nil?
25
+
26
+ @query
27
+ end
28
+
29
+ def apply_sort(sort)
30
+ sort.each do |sort_clause|
31
+ field = format_field(sort_clause[:field])
32
+ @query = @query.order(field => sort_clause[:ascending] ? :asc : :desc)
33
+ end
24
34
 
25
35
  @query
26
36
  end
@@ -1,3 +1,3 @@
1
1
  module ForestAdminDatasourceActiveRecord
2
- VERSION = "1.0.0-beta.44"
2
+ VERSION = "1.0.0-beta.46"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_datasource_active_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.beta.44
4
+ version: 1.0.0.pre.beta.46
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-05-02 00:00:00.000000000 Z
12
+ date: 2024-05-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord