effective_datatables 2.1.2 → 2.1.3

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
  SHA1:
3
- metadata.gz: a7737d3c09cfab493da58775899fcfcec9cebf6e
4
- data.tar.gz: 07baaea95de4d129716ec3b0c949c3adf427c93e
3
+ metadata.gz: 8936f9d6cfd2f9ca5a02c280c4f388526429dc15
4
+ data.tar.gz: 35401b2a9625a6f6160401d9c6efb311f29d2321
5
5
  SHA512:
6
- metadata.gz: a298d125254e19d5450ecdf719b0a96246be4b2ced78f2806ba5066996c0bfab1957555b268c2a28069ebd769d7754df962d5b35a6eb09992330504d43190722
7
- data.tar.gz: 9d4f06230ed4ecbf2e461afe72fcc5ed1f32eba2599ef99928b0293b335a0cdcd689d0ed39b3766c7069a0e2ac949d975c5df659d8085d9233dbede56370ff82
6
+ metadata.gz: e10681215022737bd36e39088b505365873a0ea63f3a419771579f7832a6b81fde1edc81f8601db1af7dce940c01a6b12b196f90eac880fbc730e4d6d1d5fbdb
7
+ data.tar.gz: d243ff06c93761d84146fe39263db11ac0bd3665664da926d676e723541b7d153365ba59106c6ea1feafcf56d271b00bddb971c7e0c4b9a81c1f1a4a9be8495a
@@ -86,6 +86,10 @@ initializeDataTables = ->
86
86
  # leftColumns: 2
87
87
  # )
88
88
 
89
+ # Apply EffectiveFormInputs to the Show x per page dropdown
90
+ if datatable.data('effective-form-inputs')
91
+ table.closest('.dataTables_wrapper').find('.dataTables_length select').select2()
92
+
89
93
  new $.fn.dataTable.ColReorder(table)
90
94
 
91
95
  $ -> initializeDataTables()
@@ -51,6 +51,8 @@ module Effective
51
51
  cols[name][:visible] = true if cols[name][:visible].nil?
52
52
 
53
53
  # Type
54
+ cols[name][:type] ||= cols[name][:as] # Use as: or type: interchangeably
55
+
54
56
  cols[name][:type] ||= (
55
57
  if belong_tos.key?(name)
56
58
  :belongs_to
@@ -115,6 +117,9 @@ module Effective
115
117
  # This is a fix for passing filter[:selected] == false, it needs to be 'false'
116
118
  filter[:selected] = filter[:selected].to_s unless filter[:selected].nil?
117
119
 
120
+ # If you pass values, just assume it's a select
121
+ filter[:type] ||= :select if filter.key?(:values)
122
+
118
123
  # Check if this is an aggregate column
119
124
  if ['SUM(', 'COUNT(', 'MAX(', 'MIN(', 'AVG('].any? { |str| sql_column.include?(str) }
120
125
  filter[:sql_operation] = :having
@@ -17,7 +17,8 @@
17
17
  'display-entries' => datatable.display_entries,
18
18
  'display-records' => (datatable.to_json[:recordsFiltered] || 0),
19
19
  'total-records' => (datatable.to_json[:recordsTotal] || 0),
20
- 'column-classes' => datatable_column_classes(datatable)
20
+ 'column-classes' => datatable_column_classes(datatable),
21
+ 'effective-form-inputs' => defined?(EffectiveFormInputs)
21
22
  }
22
23
  }
23
24
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '2.1.2'.freeze
2
+ VERSION = '2.1.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.1.2
4
+ version: 2.1.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-09-02 00:00:00.000000000 Z
11
+ date: 2015-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails