effective_datatables 2.1.5 → 2.1.6

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
  SHA1:
3
- metadata.gz: d7eefb3761460fbc53151e62474a0e0f6ded1bb6
4
- data.tar.gz: 28c135a1080fb09b617dce2812c419fb86c9fe66
3
+ metadata.gz: be50e832316ab6b4f88107a1154d7663f4c9ee37
4
+ data.tar.gz: 8e056de000c513e88fb81eb1c36e32bd7e59fdfc
5
5
  SHA512:
6
- metadata.gz: 86a487b725b6d7d5a83716d4401f291229f6922f5079630855afa9561a86d7d794011e9e83bf3725d12dd4eafc892fbc51cc968283850937908423ff18316dfe
7
- data.tar.gz: c9be60a7ab07f40c056ae15871efd1a8347a934efa2df02f4f2ee5a181693c4f946a40135692f3fe747bb8392c4a0e55c09282720e658b25ae1c3668823a0105
6
+ metadata.gz: 93f84a969b61dec2417dc810d8f777c76457f5b350e1192e6ab3bc0d0082d361c275275a3f56fc8d5ba2320ed1c16d91f9745ba4a66a9952fef433a4f5131839
7
+ data.tar.gz: 6c1076d1f1dea6356589a1f51bc095d9393acaed072cd3b0c4fa8b0eceb0a97324b2eaeb046e74a9c01f4be024d980f6169b9cd0bfda63dc9bb3e304808a0a9a
@@ -20,10 +20,14 @@ module Effective
20
20
  def order(collection)
21
21
  return collection if order_column.blank?
22
22
 
23
+ column = order_column[:column]
24
+
23
25
  if [:string, :text].include?(order_column[:type]) && order_column[:sql_as_column] != true
24
- collection.order("COALESCE(#{order_column[:column]}, '') #{order_direction}")
26
+ collection.order("COALESCE(#{column}, '') #{order_direction}")
27
+ elsif order_column[:type] == :belongs_to_polymorphic
28
+ collection.order("(#{column.sub('_id"', '_type"')}, #{column}) #{order_direction} NULLS LAST")
25
29
  else
26
- collection.order("#{order_column[:column]} #{order_direction} NULLS LAST")
30
+ collection.order("#{column} #{order_direction} NULLS LAST")
27
31
  end
28
32
  end
29
33
 
@@ -73,8 +73,8 @@ module Effective
73
73
 
74
74
  cols[name][:class] = "col-#{cols[name][:type]} col-#{name} #{cols[name][:class]}".strip
75
75
 
76
- # We can't easily sort these fields
77
- if cols[name][:type] == :has_many || cols[name][:type] == :belongs_to_polymorphic
76
+ # We can't really sort a HasMany field
77
+ if cols[name][:type] == :has_many
78
78
  cols[name][:sortable] = false
79
79
  end
80
80
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '2.1.5'.freeze
2
+ VERSION = '2.1.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_datatables
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.5
4
+ version: 2.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect