effective_datatables 4.37.2 → 4.38.0

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
  SHA256:
3
- metadata.gz: 7b568f77617338c71896ed913c966b16eb1ae7263e300e6859a40eb3aa780301
4
- data.tar.gz: 10453b93f5ffbc7fedd7722b0fdd8bbfc519f6c269c4999424a4896dd2b0c71d
3
+ metadata.gz: 2cb4f5aadf82512130c0aa2284716798def7fbcbd1ce5442bca34d13892393cf
4
+ data.tar.gz: 6fb0fa42c091876ac52fdaddd9b94fc353825aa062a30e8f9bbb46fb18aab078
5
5
  SHA512:
6
- metadata.gz: 5b622e880079211198883d2e02f1fa399fe38faec4511a188174ed7e149b588349408c5e894d5dfd1b49e6f381690943f068d2591d7c026f857f214f63a84c06
7
- data.tar.gz: 37d0f1f75c4744e6ccff4ecf9db76898ea2a60de2bbcb76e3e7738e821b4a2434edd6f48b9bdce2fa487c57bfb2c18bc3a1981daf2a1a163ce9fac5e819680d4
6
+ metadata.gz: 4321d3f210de3bef8f4dceb5820c9f49ad8761273e5ba249ed56dbe8d60d430c57101edcbf28d83fe84aae2a90bcb3aa7b4f935459fbe70965bd2310ef3b201d
7
+ data.tar.gz: 1e5993a427b48a40bacaca8156dc93093a9609d8e8053c2ab8d8ca0147c86894b8e287c4669d1e764cf160a5c524c9b4fa2deda4ba191a03630c77c6c9a866a8
@@ -28,4 +28,4 @@ renderCharts = ->
28
28
 
29
29
  $ -> initializeCharts()
30
30
  $(document).on 'page:change', -> initializeCharts()
31
- $(document).on 'turbolinks:load', -> initializeCharts()
31
+ $(document).on 'turbolinks:load turbo:load', -> initializeCharts()
@@ -204,8 +204,6 @@ $ -> initializeDataTables()
204
204
  $(document).on 'effective-datatables:initialize', (event) -> initializeDataTables(event.currentTarget)
205
205
 
206
206
  $(document).on 'page:change', -> initializeDataTables()
207
- $(document).on 'turbolinks:load', -> initializeDataTables()
208
- $(document).on 'turbolinks:render', -> initializeDataTables()
209
- $(document).on 'turbolinks:before-cache', -> destroyDataTables()
210
- $(document).on 'turbo:load', -> initializeDataTables()
211
- $(document).on 'turbo:before-cache', -> destroyDataTables()
207
+ $(document).on 'turbolinks:render turbo:render', -> initializeDataTables()
208
+ $(document).on 'turbolinks:load turbo:load', -> initializeDataTables()
209
+ $(document).on 'turbolinks:before-cache turbo:before-cache', -> destroyDataTables()
@@ -13,7 +13,7 @@ $(document).on 'ajax:before', '.dataTables_wrapper .col-actions', (event) ->
13
13
 
14
14
  $params = $.param(
15
15
  {
16
- _datatable_id: $table.attr('id'),
16
+ _datatable_id: $table.data('datatable-id'),
17
17
  _datatable_attributes: $table.data('attributes'),
18
18
  _datatable_action: true
19
19
  }
@@ -49,7 +49,9 @@ $(document).on 'ajax:success', '.dataTables_wrapper .col-actions', (event, data)
49
49
  return true if ('' + $action.data('inline')) == 'false'
50
50
 
51
51
  if data.length > 0
52
- return true if data.indexOf('Turbolinks.clearCache()') == 0 && data.includes("Turbolinks.visit(")
52
+ turbolinks_redirect = data.indexOf('Turbolinks.clearCache()') == 0 && data.includes("Turbolinks.visit(")
53
+ turbo_redirect = data.indexOf('Turbo.cache.clear()') == 0 && data.includes("Turbo.visit(")
54
+ return true if turbolinks_redirect || turbo_redirect
53
55
  return true if data.indexOf('<html') >= 0
54
56
 
55
57
  if ($action.data('method') || 'get') == 'get'
@@ -85,7 +87,7 @@ $(document).on 'ajax:before', '.dataTables_wrapper .col-inline-form', (event) ->
85
87
 
86
88
  if $form.find('input[name=_datatable_id]').length == 0
87
89
  $('<input>').attr(
88
- {type: 'hidden', name: '_datatable_id', value: $table.attr('id')}
90
+ {type: 'hidden', name: '_datatable_id', value: $table.data('datatable-id')}
89
91
  ).appendTo($form)
90
92
 
91
93
  if $form.find('input[name=_datatable_attributes]').length == 0
@@ -138,7 +140,7 @@ afterNew = ($action) ->
138
140
  $table.children('tbody').prepend($tr)
139
141
 
140
142
  expand($table)
141
- $tr.trigger('turbolinks:load')
143
+ $tr.trigger('effective-bootstrap:initialize')
142
144
  $tr.hide().fadeIn()
143
145
 
144
146
  beforeEdit = ($action) ->
@@ -169,7 +171,7 @@ afterEdit = ($action) ->
169
171
  $tr.addClass('effective-datatables-inline-row')
170
172
 
171
173
  expand($table)
172
- $tr.trigger('turbolinks:load')
174
+ $tr.trigger('effective-bootstrap:initialize')
173
175
  $tr.hide().fadeIn()
174
176
 
175
177
  # This is when one of the resource actions completes
@@ -42,6 +42,11 @@ module EffectiveDatatablesHelper
42
42
  buttons = true; input_js[:buttons] = false
43
43
  end
44
44
 
45
+ datatable_id = datatable.to_param
46
+ @_effective_datatable_ids ||= Hash.new(0)
47
+ @_effective_datatable_ids[datatable_id] += 1
48
+ dom_id = [datatable_id, (@_effective_datatable_ids[datatable_id] if @_effective_datatable_ids[datatable_id] > 1)].compact.join('-')
49
+
45
50
  # Build the datatables DOM option
46
51
  input_js[:dom] ||= [
47
52
  ("<'row'<'col-sm-12 dataTables_buttons'B>>" if buttons),
@@ -53,13 +58,14 @@ module EffectiveDatatablesHelper
53
58
  ].compact.join
54
59
 
55
60
  effective_datatable_params = {
56
- id: datatable.to_param,
61
+ id: dom_id,
57
62
  class: html_class,
58
63
  data: {
64
+ 'datatable-id' => datatable_id,
59
65
  'all-label' => I18n.t('effective_datatables.all'),
60
66
  'attributes' => EffectiveDatatables.encrypt(datatable.attributes),
61
67
  'authenticity-token' => form_authenticity_token,
62
- 'buttons-html' => datatable_buttons(datatable),
68
+ 'buttons-html' => datatable_buttons(datatable, dom_id: dom_id),
63
69
  'columns' => datatable_columns(datatable),
64
70
  'default-visibility' => datatable.default_visibility.to_json,
65
71
  'display-length' => datatable.display_length,
@@ -88,7 +94,7 @@ module EffectiveDatatablesHelper
88
94
  end
89
95
 
90
96
  if filters
91
- output << render_datatable_filters(datatable)
97
+ output << render_datatable_filters(datatable, dom_id: dom_id)
92
98
  end
93
99
 
94
100
  output << render(partial: 'effective/datatables/datatable',
@@ -25,8 +25,8 @@ module EffectiveDatatablesPrivateHelper
25
25
  ((datatable.sortable? && datatable.order_index) ? [datatable.order_index, datatable.order_direction] : false).to_json.html_safe
26
26
  end
27
27
 
28
- def datatable_buttons(datatable, search: true)
29
- render('/effective/datatables/buttons', datatable: datatable, search: search).gsub("'", '"').html_safe
28
+ def datatable_buttons(datatable, search: true, dom_id: datatable.to_param)
29
+ render('/effective/datatables/buttons', datatable: datatable, search: search, dom_id: dom_id).gsub("'", '"').html_safe
30
30
  end
31
31
 
32
32
  def datatable_length_menu(datatable)
@@ -145,16 +145,16 @@ module EffectiveDatatablesPrivateHelper
145
145
  end
146
146
  end
147
147
 
148
- def render_datatable_filters(datatable)
148
+ def render_datatable_filters(datatable, dom_id: datatable.to_param)
149
149
  raise 'expected datatable to be present' unless datatable
150
150
 
151
151
  datatable.view ||= self
152
152
  return unless datatable._scopes.present? || datatable._filters.present?
153
153
 
154
154
  if datatable._filters_form_required?
155
- render('effective/datatables/filters', datatable: datatable)
155
+ render('effective/datatables/filters', datatable: datatable, dom_id: dom_id)
156
156
  else
157
- render('effective/datatables/filters', datatable: datatable).gsub('<form', '<div').gsub('/form>', '/div>').html_safe
157
+ render('effective/datatables/filters', datatable: datatable, dom_id: dom_id).gsub('<form', '<div').gsub('/form>', '/div>').html_safe
158
158
  end
159
159
 
160
160
  end
@@ -1,3 +1,5 @@
1
+ - dom_id ||= datatable.to_param
2
+
1
3
  - if datatable._bulk_actions.present?
2
4
  = render('/effective/datatables/bulk_actions_dropdown', datatable: datatable)
3
5
 
@@ -10,5 +12,5 @@
10
12
  %span= t('effective_datatables.reorder')
11
13
 
12
14
  - if datatable.downloadable?
13
- = link_to 'download.csv', class: 'btn btn-link btn-sm buttons-download', 'aria-controls': datatable.to_param do
15
+ = link_to 'download.csv', class: 'btn btn-link btn-sm buttons-download', 'aria-controls': dom_id do
14
16
  %span= t('effective_datatables.download')
@@ -1,4 +1,5 @@
1
- .effective-datatables-filters{'aria-controls': datatable.to_param}
1
+ - dom_id ||= datatable.to_param
2
+ .effective-datatables-filters{'aria-controls': dom_id}
2
3
 
3
4
  = effective_form_with(model: datatable.filters_form, scope: :filters, url: (datatable._form[:url] || '#'), method: datatable._form[:verb], id: nil, authenticity_token: datatable._filters_form_required?) do |form|
4
5
  .form-row.align-items-center
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.37.2'.freeze
2
+ VERSION = '4.38.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_datatables
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.37.2
4
+ version: 4.38.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2026-07-06 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rails
@@ -196,7 +195,6 @@ homepage: https://github.com/code-and-effect/effective_datatables
196
195
  licenses:
197
196
  - MIT
198
197
  metadata: {}
199
- post_install_message:
200
198
  rdoc_options: []
201
199
  require_paths:
202
200
  - lib
@@ -211,8 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
209
  - !ruby/object:Gem::Version
212
210
  version: '0'
213
211
  requirements: []
214
- rubygems_version: 3.5.9
215
- signing_key:
212
+ rubygems_version: 4.0.17
216
213
  specification_version: 4
217
214
  summary: Uniquely powerful server-side searching, sorting and filtering of any ActiveRecord
218
215
  or Array collection as well as post-rendered content displayed as a frontend jQuery