effective_datatables 3.3.8 → 3.3.9

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: cbae61797a7b6084534c427e079daab64a41b582
4
- data.tar.gz: 7f405c39bdd5cb5d85dee540afc0ff068f3a0723
3
+ metadata.gz: ce69b43f6120213c50308b64411d9a070a4ada51
4
+ data.tar.gz: 379f3c71489e71380bac3affad255c535e6474de
5
5
  SHA512:
6
- metadata.gz: 15df55789b6ad8ef5e27cb042f988042705ce5530f34198b17bd8de62013c18e1f8ea2c30227f5081b82e33fdfd9f69e83c3f14d61b8af0bab70409273a12bfa
7
- data.tar.gz: b854e4df72d2bd1f13a837bc2c5ba588cd6f9a2d6c9757dd43e5cbb0395ecd013ac4eb1db2f388b75ffe6c5743aff0c1136aac1b13565105c4ac737e32064ec5
6
+ metadata.gz: 79a6f609f33333ce5310309fd3f7a4439837217b08feec9ec3351fead3b237b5c2da33d163c5c9fe09c413be19dd74f899b343dbf9da33c0d45de42559322e3f
7
+ data.tar.gz: bf7cf430ce6fa63d37fb8d7a1c87d6e3a7d2e0a0c9f00d5012028625cf4f02364d38e32cf1ac0baf88c03d3a0d2a3b556f244d65fa5ec452cc6b94e19abe14be
@@ -52,7 +52,7 @@ initializeDataTables = ->
52
52
  dom: "<'row'<'col-sm-12'B>><'row'<'col-sm-12'tr>><'row'<'col-sm-6 dataTables_entries'il><'col-sm-6'p>>"
53
53
  iDisplayLength: datatable.data('display-length')
54
54
  language: { 'lengthMenu': '&nbsp;with _MENU_ per page'}
55
- lengthMenu: [[10, 25, 50, 100, 250, 500, 9999999], ['10', '25', '50', '100', '250', '500', 'All']]
55
+ lengthMenu: [[5, 10, 25, 50, 100, 250, 500, 9999999], ['5', '10', '25', '50', '100', '250', '500', 'All']]
56
56
  order: datatable.data('display-order')
57
57
  processing: true
58
58
  responsive: true
@@ -175,7 +175,7 @@ module Effective
175
175
  if column[:format]
176
176
  datatable.dsl_tool.instance_exec(obj, row, &column[:format])
177
177
  elsif column[:partial]
178
- raise 'unsupported'
178
+ obj.to_s
179
179
  elsif obj.respond_to?(column[:name])
180
180
  obj.send(column[:name])
181
181
  elsif column[:as] == :time && obj.respond_to?(:strftime)
@@ -88,7 +88,7 @@ module Effective
88
88
  end
89
89
  end
90
90
 
91
- def aggregate(collection)
91
+ def aggregate(collection, raw: false) # raw values
92
92
  cols = collection.transpose
93
93
 
94
94
  _aggregates.map do |_, aggregate|
@@ -109,6 +109,8 @@ module Effective
109
109
  dsl_tool.instance_exec(values, columns[name], &opts[:aggregate])
110
110
  elsif aggregate[:compute]
111
111
  dsl_tool.instance_exec(values, columns[name], &aggregate[:compute])
112
+ elsif raw
113
+ aggregate_column(values, opts, aggregate)
112
114
  else
113
115
  format_column(aggregate_column(values, opts, aggregate), opts)
114
116
  end || BLANK
@@ -133,7 +135,7 @@ module Effective
133
135
  end
134
136
  when :average
135
137
  if values.all? { |value| value.kind_of?(Numeric) }
136
- values.sum / [length, 1].max
138
+ values.sum / ([length, 1].max)
137
139
  elsif values.all? { |value| value == true || value == false }
138
140
  values.count { |val| val == true } >= (length / 2) ? true : false
139
141
  elsif aggregate[:labeled] == false
@@ -11,7 +11,7 @@ module Effective
11
11
  end
12
12
 
13
13
  def length(length)
14
- raise 'length must be 10, 25, 50, 100, 250, 500, :all' unless [10, 25, 50, 100, 250, 500, :all].include?(length)
14
+ raise 'length must be 5, 10, 25, 50, 100, 250, 500, :all' unless [5, 10, 25, 50, 100, 250, 500, :all].include?(length)
15
15
  datatable.state[:length] ||= (length == :all ? 9999999 : length)
16
16
  end
17
17
 
@@ -36,7 +36,7 @@ module Effective
36
36
  value = row[index]
37
37
 
38
38
  row[index] = (
39
- if opts[:format] && opts[:as] == :actions
39
+ if opts[:format] && rendered.key?(name)
40
40
  dsl_tool.instance_exec(value, row, rendered[name][row_index], &opts[:format])
41
41
  elsif opts[:format]
42
42
  dsl_tool.instance_exec(value, row, &opts[:format])
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '3.3.8'.freeze
2
+ VERSION = '3.3.9'.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: 3.3.8
4
+ version: 3.3.9
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: 2017-11-22 00:00:00.000000000 Z
11
+ date: 2018-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails