forest_admin_datasource_active_record 1.0.0.pre.beta.45 → 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: 984151758c8b29b07a7d7bb4b239efbc9df403edd85bc4bad43b0ba538ef78a7
4
- data.tar.gz: 948c16acc703105a98042e5953a800a63a91aecb3e19094121ced88fca0e6e92
3
+ metadata.gz: 07a8bdd2af59c3debde1fb639ed93c2542f62b7e73dcb8ad5569a68754a21ee7
4
+ data.tar.gz: 22a913eb8b04ff9304f4b60c56c41df3b2128d8481c195d4f05c3445009bfb61
5
5
  SHA512:
6
- metadata.gz: 9264b779ca22365e4b5726587af9781208f4ad3430faf1b416c3d7a8165575ca74f0d6fb5a3443ddcef3a812a589ba461187aef0e09b1caf49143a2b5614fbe9
7
- data.tar.gz: 778cd5fb95c8d643cfba5d57ee539e6768dfb90f7decd0b7499aeb78d7a15089107e61c724bf083a8d0fcc31c04078d4dfd1e842529874b11b9b4ba42cd31cc2
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.45"
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.45
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-03 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