effective_datatables 4.3.23 → 4.3.24

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: e9103e5d57c0218b0e58169b02848afb057fab9a
4
- data.tar.gz: a88158032fb84eba48715a905cae56c62109aa1e
3
+ metadata.gz: 837c6fb296619d4702ade84dabb37a83b5365857
4
+ data.tar.gz: 98fb11c65c1ed5fcddf849fdc06cc0d43cabfce3
5
5
  SHA512:
6
- metadata.gz: 3597f751ede4accd994fcb97c2fc92f0b55bf6bc8db23daaaedbe82bf2f281425b238d9b703479b77f5046fc520933aef3c5c58937ba16a323362fad664ed19a
7
- data.tar.gz: 158ce8b46ab3716c514443596a6fb16d84bb9f72fe4072ca6728360f43735293e7292470199aa8561986a48b4a3bdaf55dbaccbb53c2feeef225839b1fe81336
6
+ metadata.gz: 946f4f80a506e7c8f6b5ab7445b8e274068cc5d10fcdb0fa5d475240976d19ed58aeae7996593e8af1686f59ad48685ae1c0293ff53ac9b6f6df199fb2077a26
7
+ data.tar.gz: 33f482a18a73adf8901f57d87f50c6262abcd5981b755555990fb4f2e0f31f50e8e871daf62a9f2204b4ad0b168b1dc874786a3856e86ae65166d673f676661f
@@ -64,17 +64,19 @@ $(document).on 'effective-form:success', '.dataTables_wrapper .col-inline-form',
64
64
  $table = $tr.closest('table')
65
65
 
66
66
  if $tr.hasClass('effective-datatables-new-resource')
67
- $table.DataTable().flash(flash || 'Item created', 'success').draw()
67
+ $table.DataTable().flash(flash || 'Item created', 'success')
68
68
  $tr.fadeOut('slow')
69
69
 
70
70
  $actions = $table.children('thead').find('th.col-actions')
71
71
  $actions.children('svg').remove()
72
72
  $actions.children('a').fadeIn()
73
73
  else
74
- $table.DataTable().flash(flash || 'Item updated', 'success').draw()
74
+ $table.DataTable().flash(flash || 'Item updated', 'success')
75
75
  $tr.fadeOut('slow')
76
76
 
77
- refreshDatatables($table)
77
+ unless redirectDatatables($table)
78
+ $table.DataTable().draw()
79
+ refreshDatatables($table)
78
80
 
79
81
  beforeNew = ($action) ->
80
82
  $table = $action.closest('table')
@@ -136,11 +138,13 @@ afterAction = ($action) ->
136
138
 
137
139
  if EffectiveForm.remote_form_flash.length > 0
138
140
  flash = EffectiveForm.remote_form_flash[0]
139
- $table.DataTable().flash(flash[1], flash[0]).draw()
141
+ $table.DataTable().flash(flash[1], flash[0])
140
142
  else
141
- $table.DataTable().flash('Successfully ' + $action.attr('title'), 'success').draw()
143
+ $table.DataTable().flash('Successfully ' + $action.attr('title'), 'success')
142
144
 
143
- refreshDatatables($table)
145
+ unless redirectDatatables($table)
146
+ $table.DataTable().draw()
147
+ refreshDatatables($table)
144
148
 
145
149
  buildRow = (length, payload) ->
146
150
  "<td class='col-inline-form' colspan='#{length-1}'><div class='container'>#{payload}</div></td>" +
@@ -158,6 +162,19 @@ cancel = ($table) ->
158
162
  if $wrapper.find('.effective-datatables-inline-row').length == 0
159
163
  $wrapper.removeClass('effective-datatables-inline-expanded')
160
164
 
165
+ redirectDatatables = ($source) ->
166
+ return false unless EffectiveForm.remote_form_refresh_datatables.length > 0
167
+
168
+ if EffectiveForm.remote_form_refresh_datatables.includes('refresh')
169
+ if Turbolinks?
170
+ Turbolinks.visit(window.location.href, { action: 'replace'})
171
+ else
172
+ window.location.reload()
173
+
174
+ return true
175
+
176
+ false
177
+
161
178
  refreshDatatables = ($source) ->
162
179
  return unless EffectiveForm.remote_form_refresh_datatables.length > 0
163
180
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.3.23'.freeze
2
+ VERSION = '4.3.24'.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.3.23
4
+ version: 4.3.24
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-02-23 00:00:00.000000000 Z
11
+ date: 2019-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails