effective_datatables 4.5.2 → 4.5.3

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: 801035ec41d62120ec00afa643d281fd0bcf5918
4
- data.tar.gz: 9551e713b05fac2d08f1e4c83db278469f5a182d
3
+ metadata.gz: f73868f30d757dbceec3c540399e657f754140ba
4
+ data.tar.gz: ac64d4fd479f389703a2d8ff33a13c96baef82b3
5
5
  SHA512:
6
- metadata.gz: 40fc0df539d7c55bf3b10e5265dc145147e87f0f62543c6e67a139d681bf43b97a6df05ddff14ba9178348d9fe04139a532e870d51892aa85bd2720d64233a13
7
- data.tar.gz: baa7bedfdf52a8adeb73a7a9e7d5eea2b12b10dc901c7a577be94040a15851acacfc7ede503e847ab9b513131d440b0d210ce75545bd0a7d17100b3ade8579b7
6
+ metadata.gz: 554a2ba6fa77dda79130231dfb466b294de74ae17e7770a46af79a29bfba91f8b2f2f3d3e4c4e7f6464d0b34e2f4f22f7b4e909411769c9ba559cde39578736a
7
+ data.tar.gz: e2cd5f8b2131b6ea9cbac07b73e46bf006c69ebc17866921e7121e2ffbf5fc61634793da5f60832b989c192f5419d343cfc409241018948a3094c0029b6aaf1b
@@ -185,6 +185,8 @@ initializeDataTables = (target) ->
185
185
  table.DataTable().on('row-reorder', (event, diff, edit) -> $(event.target).DataTable().reorder(event, diff, edit))
186
186
 
187
187
  table.addClass('initialized')
188
+ table.children('thead').trigger('effective-bootstrap:initialize')
189
+ true
188
190
 
189
191
  destroyDataTables = ->
190
192
  $('.effective-datatables-inline-expanded').removeClass('effective-datatables-inline-expanded')
@@ -21,11 +21,15 @@ $(document).on 'ajax:beforeSend', '.dataTables_wrapper .col-actions', (e, xhr, s
21
21
  true
22
22
 
23
23
  # We have either completed the resource action, or fetched the inline form to load.
24
- $(document).on 'ajax:success', '.dataTables_wrapper .col-actions', (event) ->
24
+ $(document).on 'ajax:success', '.dataTables_wrapper .col-actions', (event, data) ->
25
25
  $action = $(event.target)
26
26
 
27
27
  return true if ('' + $action.data('inline')) == 'false'
28
28
 
29
+ if data.length > 0
30
+ return true if data.indexOf('Turbolinks.clearCache()') == 0 && data.includes("Turbolinks.visit(")
31
+ return true if data.indexOf('<html') >= 0
32
+
29
33
  if ($action.data('method') || 'get') == 'get'
30
34
  if $action.closest('tr').parent().prop('tagName') == 'THEAD' then afterNew($action) else afterEdit($action)
31
35
  else
@@ -34,6 +38,7 @@ $(document).on 'ajax:success', '.dataTables_wrapper .col-actions', (event) ->
34
38
  EffectiveForm.remote_form_payload = ''
35
39
  EffectiveForm.remote_form_flash = ''
36
40
  EffectiveForm.remote_form_refresh_datatables = ''
41
+
37
42
  true
38
43
 
39
44
  # There was an error completing something
@@ -113,12 +113,30 @@ module Effective
113
113
 
114
114
  # Takes all default resource actions
115
115
  # Applies data-remote to anything that's data-method post or delete
116
+ # Merges in any extra attributes when passed as a Hash
116
117
  def actions_col_actions(column)
117
- if column[:inline]
118
+ actions = if column[:inline]
118
119
  resource.resource_actions.transform_values { |opts| opts['data-remote'] = true; opts }
119
120
  else
120
121
  resource.resource_actions.transform_values { |opts| opts['data-remote'] = true if opts['data-method']; opts }
121
122
  end
123
+
124
+ # Merge local options. Special behaviour for remote: false
125
+ if column[:actions].kind_of?(Hash)
126
+ column[:actions].each do |action, opts|
127
+ next unless opts.kind_of?(Hash)
128
+
129
+ existing = actions.find { |_, v| v[:action] == action }.first
130
+ next unless existing.present?
131
+
132
+ actions[existing]['data-remote'] = opts[:remote] if opts.key?(:remote)
133
+ actions[existing]['data-remote'] = opts['remote'] if opts.key?('remote')
134
+
135
+ actions[existing].merge!(opts.except(:remote, 'remote'))
136
+ end
137
+ end
138
+
139
+ actions
122
140
  end
123
141
 
124
142
  def resource_col_locals(opts)
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.5.2'.freeze
2
+ VERSION = '4.5.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_datatables
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.2
4
+ version: 4.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect