effective_datatables 2.2.2 → 2.2.3

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: 23149a11f5d924187b057923850c1883278bed56
4
- data.tar.gz: af8cebc2b8ed50a9c1ab9bf3ea9d76a6572ef3bc
3
+ metadata.gz: accdc49e5adcbb84639c6f04e26a080544bd8f4b
4
+ data.tar.gz: 763d0016579e806d0d77b54a62caedcbf049b6df
5
5
  SHA512:
6
- metadata.gz: b9f8b343da4185651b0e55e4d2b72ded088cb360962d31e71da5886000c26403046c69c2c0c4445c71900adf42cf00c879393823fe66b0592cbaa63286c656d5
7
- data.tar.gz: b564536eb290f27fdf2721dd37902dcfa441a7224eab2703edc27d24037dbe1f1674597df8fe3baa2af808d755d0c0b9424b93b36e6817e4c16d65143c80aa44
6
+ metadata.gz: 63c01f326d91d3eac11bf530291e193f44e96b418ad2162e54a636b0cba91b4911b751c3389221841470a79ba382f4662a799fc6c133769642fe915088c3e8e4
7
+ data.tar.gz: 1690d18d9e6656b9ddf3dfdeb4351203355fc6c188434dcfde87a0cc7d0d7de5a1a7690f97ec1198f3fb89dc426b00a9a0b7cf49e8cb3f3c7cc0850a3fe7af3d
@@ -35,6 +35,11 @@ table.dataTable thead th {
35
35
  .form-group { margin-bottom: 0px; font-weight: normal; }
36
36
  }
37
37
 
38
+ table.dataTable td ul {
39
+ list-style: none;
40
+ padding-left: 0;
41
+ }
42
+
38
43
  // Sorting disabled
39
44
  table.dataTable.sort-hidden thead .sorting { background-image: none; }
40
45
  table.dataTable.sort-hidden thead .sorting_asc { background-image: none; }
@@ -78,8 +78,6 @@ module EffectiveDatatablesHelper
78
78
  group_method: opts[:filter][:group_method] || :last,
79
79
  input_html: { name: nil, autocomplete: 'off', data: {'column-name' => opts[:name], 'column-index' => opts[:index]} },
80
80
  input_js: { placeholder: (opts[:label] || name.titleize) }
81
- else
82
- content_tag(:p, opts[:label] || name)
83
81
  end
84
82
  end
85
83
 
@@ -24,7 +24,7 @@ module Effective
24
24
  before = ''; after = ''
25
25
 
26
26
  if postgres?
27
- after = ' NULLS LAST'
27
+ after = " NULLS #{order_direction == 'DESC' ? 'FIRST' : 'LAST' }"
28
28
  elsif mysql?
29
29
  before = "ISNULL(#{column}), "
30
30
  end
@@ -54,7 +54,11 @@ module Effective
54
54
  case table_column[:type]
55
55
  when :string, :text
56
56
  if (table_column[:filter][:type] == :select && table_column[:filter][:fuzzy] != true) || sql_op != :where
57
- collection.public_send(sql_op, "#{column} = :term", term: term)
57
+ if ['null', 'nil', nil].include?(term)
58
+ collection.public_send(sql_op, "#{column} = :term OR #{column} IS NULL", term: term)
59
+ else
60
+ collection.public_send(sql_op, "#{column} = :term", term: term)
61
+ end
58
62
  else
59
63
  collection.public_send(sql_op, "#{column} #{ilike} :term", term: "%#{term}%")
60
64
  end
@@ -99,7 +99,7 @@ module Effective
99
99
  cols[name][:type] = :effective_roles
100
100
  end
101
101
 
102
- if sql_table.present? && sql_column.blank? # This is a SELECT AS column
102
+ if sql_table.present? && sql_column.blank? # This is a SELECT AS column, or a JOIN column
103
103
  cols[name][:sql_as_column] = true
104
104
  end
105
105
 
@@ -131,8 +131,15 @@ module Effective
131
131
  # This is a fix for passing filter[:selected] == false, it needs to be 'false'
132
132
  filter[:selected] = filter[:selected].to_s unless filter[:selected].nil?
133
133
 
134
+ # Allow values or collection to be used interchangeably
135
+ if filter.key?(:collection)
136
+ filter[:values] ||= filter[:collection]
137
+ end
138
+
134
139
  # If you pass values, just assume it's a select
135
- filter[:type] ||= :select if filter.key?(:values) && col_type != :belongs_to_polymorphic
140
+ if filter.key?(:values) && col_type != :belongs_to_polymorphic
141
+ filter[:type] ||= :select
142
+ end
136
143
 
137
144
  # Check if this is an aggregate column
138
145
  if ['SUM(', 'COUNT(', 'MAX(', 'MIN(', 'AVG('].any? { |str| sql_column.include?(str) }
@@ -141,6 +141,10 @@ module Effective
141
141
  next if value == nil || value == BLANK || opts[:visible] == false
142
142
  next if opts[:block] || opts[:partial] || opts[:proc]
143
143
 
144
+ if opts[:sql_as_column]
145
+ row[index] = value.to_s
146
+ end
147
+
144
148
  case opts[:type]
145
149
  when :belongs_to, :belongs_to_polymorphic
146
150
  row[index] = value.to_s
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '2.2.2'.freeze
2
+ VERSION = '2.2.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_datatables
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-08 00:00:00.000000000 Z
11
+ date: 2015-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails