effective_datatables 4.4.4 → 4.4.5

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: a976fdcb95a6a0fa08a6f7cb3f22f33590a4d68c
4
- data.tar.gz: 2dbd5417952dd9ac41471422e176595b8cf1dc49
3
+ metadata.gz: 158ddf59a09940c2dee6187aa2e206104f8552e8
4
+ data.tar.gz: ea19c893a0e184003d5f60007a171efd07417003
5
5
  SHA512:
6
- metadata.gz: f1df233ae2302a519c4a308d271ae5c4fe20983f035a03667cea30152d87f6a6f001d2468d259c8c0dbe7d9e7a3dbf39477b840564e75b4e64f72bd15a52db41
7
- data.tar.gz: cb9397af7b7082c4c28386cf265027aabea7472c07b7d1623cb7929f2699f5e9935632fed7684edb7eb5aefe38f174d1bbed889cae0e9a73e1d526cc1afffe76
6
+ metadata.gz: 86fe5b9307c518671509dce63bdc6e4b9e99c9a6af22fb992aca3eeee61fba645f3028f1d89702ae0578ae0961dab091b15758e8f81c61c29a9b611ba4b2f86f
7
+ data.tar.gz: c775b5445a7a328e04b48c24ca6bf9fc2da86c6fdc7cf0860d6dd69d75379e200f5d104085a7a6c9256ba96041e9c322971e1669db61315c86691efd9c9db94e
data/README.md CHANGED
@@ -15,6 +15,12 @@ This gem includes the jQuery DataTables assets.
15
15
 
16
16
  Works with postgres, mysql, sqlite3 and arrays.
17
17
 
18
+ ## Live Demo
19
+
20
+ Click here for a [Live Demo](https://effective-datatables-demo.herokuapp.com/).
21
+
22
+ See [effective_datatables_demo](https://github.com/code-and-effect/effective_datatables_demo) for a working rails website example.
23
+
18
24
  ## effective_datatables 4.0
19
25
 
20
26
  This is the 4.0 series of effective_datatables.
@@ -744,7 +750,7 @@ parse: -> { |term| term.to_i } # Parse the incoming term (string) into whatever
744
750
  required: true|false # Passed to form
745
751
  ```
746
752
 
747
- Any other option given will be yielded to SimpleForm as `input_html` options.
753
+ Any other option given will be yielded to EffectiveBootstrap as options.
748
754
 
749
755
  ## bulk_actions
750
756
 
@@ -999,9 +1005,11 @@ datatable do
999
1005
  duration = (hours.to_i * 60) + minutes.to_i
1000
1006
 
1001
1007
  collection.select! { |row| row[index] == duration } # Must return an Array of Arrays
1002
- end.sort do |collection, term, column, index|
1003
- collection.sort! do |x, y|
1004
- x[index] <=> y[index]
1008
+ end.sort do |collection, direction, column, index|
1009
+ if direction == :asc
1010
+ collection.sort! { |a, b| a[index] <=> b[index] }
1011
+ else
1012
+ collection.sort! { |a, b| b[index] <=> a[index] }
1005
1013
  end
1006
1014
  end
1007
1015
  end
@@ -89,7 +89,7 @@ module Effective
89
89
  if opts[:as].kind_of?(Class) && opts[:as].ancestors.include?(ActiveRecord::Base)
90
90
  opts[:resource] = Effective::Resource.new(opts[:as], namespace: controller_namespace)
91
91
  opts[:as] = :resource
92
- elsif opts[:as] == nil
92
+ elsif opts[:as] == nil && row.present?
93
93
  if (value = Array(row[opts[:index]]).first).kind_of?(ActiveRecord::Base)
94
94
  opts[:resource] = Effective::Resource.new(value, namespace: controller_namespace)
95
95
  opts[:as] = :resource
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.4.4'.freeze
2
+ VERSION = '4.4.5'.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: 4.4.4
4
+ version: 4.4.5
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: 2019-04-12 00:00:00.000000000 Z
11
+ date: 2019-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails