effective_datatables 4.8.9 → 4.8.14

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
  SHA256:
3
- metadata.gz: da2dfe401e2839d034033b2af1b0048cf3c6a726b87a1f6ccc4354eb71183f55
4
- data.tar.gz: b6c6a44db10ce020e32bd79de4f1dc8a77106122f7725524414e0ccfa2ee4265
3
+ metadata.gz: 065a97713aa78f1febed39ab02736af303742cc15a691fa556f60225035bdc91
4
+ data.tar.gz: dcfe7909bd5e6a30a16ca700bdaf01721ca95590a58b36ee20c5f17f446faa36
5
5
  SHA512:
6
- metadata.gz: 75201440e6f62b181ebce2f54dbaedcffae413a42803e1b0e39a7869f8425e776d51b10b88c2625d142a89895eb6f4ab3f174715782bdb068c5958908b0e36a3
7
- data.tar.gz: b9442dab7b1f1b7a1b34e39ec1b67e3241757b1978272ea051c01cf77a9ae074b1ccac33aa18cc52a84a1f735697b41c72fba970a1d39a0c1a734d40c17f125c
6
+ metadata.gz: ea4bd624315535fd4eca9ae8abef4176c10fc7033e0dc45cf2d6fa56a439dad5adbf81a5249d727b02c0e4a0f6d799710779fd69b8d80aaab779c2b3dadb716c
7
+ data.tar.gz: 075defd26c55ed28f71dc6a8becd9efb71c2edf51799c56568b8fbfc612689e95b0cf3bdfe7b7447eb858261b11a1878366792074ba254cef7b2c0e0cb6eaecb
@@ -52,7 +52,7 @@ initializeDataTables = (target) ->
52
52
  displayStart: datatable.data('display-start')
53
53
  iDisplayLength: datatable.data('display-length')
54
54
  language: datatable.data('language')
55
- lengthMenu: [[5, 10, 25, 50, 100, 250, 500, 9999999], ['5', '10', '25', '50', '100', '250', '500', 'All']]
55
+ lengthMenu: [[5, 10, 25, 50, 100, 250, 500, 9999999], ['5', '10', '25', '50', '100', '250', '500', datatable.data('all-label')]]
56
56
  order: datatable.data('display-order')
57
57
  processing: true
58
58
  responsive: true
@@ -80,7 +80,7 @@ initializeDataTables = (target) ->
80
80
  filter_name = name.replace('filters[', '').substring(0, name.length-9)
81
81
 
82
82
  params['filter'][filter_name] = $form.find("input[name='#{name}']:checked").val()
83
-
83
+
84
84
  else if $input.attr('id')
85
85
  filter_name = $input.attr('id').replace('filters_', '')
86
86
  params['filter'][filter_name] = $input.val()
@@ -165,7 +165,6 @@ initializeDataTables = (target) ->
165
165
  $input.on 'change', (event) -> dataTableSearch($(event.currentTarget))
166
166
  else if $input.is('input')
167
167
  $input.delayedChange ($input) -> dataTableSearch($input)
168
- $input.on('paste', -> dataTableSearch($input))
169
168
 
170
169
  # Do the actual search
171
170
  dataTableSearch = ($input) -> # This is the function called by a select or input to run the search
@@ -8,7 +8,14 @@ reorder = (event, diff, edit) ->
8
8
  return unless oldNode? && newNode?
9
9
 
10
10
  url = @context[0].ajax.url.replace('.json', '/reorder.json')
11
- data = {'reorder[id]': oldNode.data('reorder-resource'), 'reorder[old]': oldNode.val(), 'reorder[new]': newNode.val(), attributes: $table.data('attributes') }
11
+
12
+ data = {
13
+ 'authenticity_token': $('head').find("meta[name='csrf-token']").attr('content'),
14
+ 'reorder[id]': oldNode.data('reorder-resource'),
15
+ 'reorder[old]': oldNode.val(),
16
+ 'reorder[new]': newNode.val(),
17
+ 'attributes': $table.data('attributes')
18
+ }
12
19
 
13
20
  @context[0].rowreorder.c.enable = false
14
21
 
@@ -40,4 +47,3 @@ $(document).on 'click', '.dataTables_wrapper a.buttons-reorder', (event) ->
40
47
  $table.addClass('reordering')
41
48
 
42
49
  column.visible(!column.visible())
43
-
@@ -14,7 +14,7 @@
14
14
 
15
15
  return this.each(function() {
16
16
  var element = $(this);
17
- element.keyup(function() {
17
+ element.on('keyup paste', function() {
18
18
  clearTimeout(timer);
19
19
  timer = setTimeout(function() {
20
20
  var newVal = element.val();
@@ -40,6 +40,7 @@ module EffectiveDatatablesHelper
40
40
  id: datatable.to_param,
41
41
  class: html_class,
42
42
  data: {
43
+ 'all-label' => I18n.t('effective_datatables.all'),
43
44
  'attributes' => EffectiveDatatables.encrypt(datatable.attributes),
44
45
  'authenticity-token' => form_authenticity_token,
45
46
  'bulk-actions' => datatable_bulk_actions(datatable),
@@ -1,8 +1,8 @@
1
1
  module Effective
2
2
  class Datatable
3
3
  attr_reader :attributes # Anything that we initialize our table with. That's it. Can't be changed by state.
4
- attr_reader :effective_resource
5
4
  attr_reader :state
5
+ attr_accessor :effective_resource
6
6
 
7
7
  # Hashes of DSL options
8
8
  attr_reader :_aggregates
@@ -88,9 +88,9 @@ module Effective
88
88
  when :currency
89
89
  view.number_to_currency(value)
90
90
  when :date
91
- (value.strftime('%F') rescue BLANK)
91
+ value.respond_to?(:strftime) ? value.strftime(EffectiveDatatables.format_date) : BLANK
92
92
  when :datetime
93
- (value.strftime('%F %H:%M') rescue BLANK)
93
+ value.respond_to?(:strftime) ? value.strftime(EffectiveDatatables.format_datetime) : BLANK
94
94
  when :decimal
95
95
  value
96
96
  when :duration
@@ -116,7 +116,7 @@ module Effective
116
116
  when Numeric ; view.number_to_currency(value)
117
117
  end
118
118
  when :time
119
- (value.strftime('%H:%M') rescue BLANK)
119
+ value.respond_to?(:strftime) ? value.strftime(EffectiveDatatables.format_time) : BLANK
120
120
  else
121
121
  value.to_s
122
122
  end
@@ -31,7 +31,7 @@ module Effective
31
31
  end
32
32
 
33
33
  def load_effective_resource!
34
- @effective_resource = if active_record_collection?
34
+ @effective_resource ||= if active_record_collection?
35
35
  Effective::Resource.new(collection_class, namespace: controller_namespace)
36
36
  end
37
37
  end
@@ -39,4 +39,8 @@ EffectiveDatatables.setup do |config|
39
39
  config.cookie_domain = :all # Should usually be :all
40
40
  config.cookie_tld_length = nil # Leave nil to autodetect, or set to probably 2
41
41
 
42
+ # Date formatting
43
+ config.format_datetime = '%F %H:%M'
44
+ config.format_date = '%F'
45
+ config.format_time = '%H:%M'
42
46
  end
@@ -9,4 +9,5 @@ en:
9
9
  bulk_actions: Bulk Actions
10
10
  applying: Applying...
11
11
  boolean_true: 'Yes'
12
- boolean_false: 'No'
12
+ boolean_false: 'No'
13
+ all: All
@@ -9,4 +9,5 @@ es:
9
9
  bulk_actions: Acciones en masa
10
10
  applying: Filtrando...
11
11
  boolean_true: 'Sí'
12
- boolean_false: 'No'
12
+ boolean_false: 'No'
13
+ all: Todo
@@ -9,4 +9,5 @@ nl:
9
9
  bulk_actions: Bulkacties
10
10
  applying: Toepassen...
11
11
  boolean_true: 'Ja'
12
- boolean_false: 'Nee'
12
+ boolean_false: 'Nee'
13
+ all: Te doen
@@ -16,6 +16,10 @@ module EffectiveDatatables
16
16
  mattr_accessor :cookie_domain
17
17
  mattr_accessor :cookie_tld_length
18
18
 
19
+ mattr_accessor :format_datetime
20
+ mattr_accessor :format_date
21
+ mattr_accessor :format_time
22
+
19
23
  mattr_accessor :debug
20
24
 
21
25
  alias_method :max_cookie_size, :cookie_max_size
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.8.9'.freeze
2
+ VERSION = '4.8.14'.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.8.9
4
+ version: 4.8.14
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: 2020-09-18 00:00:00.000000000 Z
11
+ date: 2021-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  requirements: []
196
- rubygems_version: 3.1.4
196
+ rubygems_version: 3.1.2
197
197
  signing_key:
198
198
  specification_version: 4
199
199
  summary: Uniquely powerful server-side searching, sorting and filtering of any ActiveRecord