effective_datatables 4.5.2 → 4.5.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f73868f30d757dbceec3c540399e657f754140ba
|
4
|
+
data.tar.gz: ac64d4fd479f389703a2d8ff33a13c96baef82b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|