effective_datatables 3.0.16 → 3.1.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed64f666d0e25311df8bd6d261f91561ff5a4b06
|
4
|
+
data.tar.gz: 80cbfdb2f683497fdbfff4f373068ee254fefb69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5f12a41603c30fdbaea17b0eabcdf801baada748aca0b020e0d570911389b599fb1c10a1b09b4b5a4cfa77346c85c70940435ddf7cac64d567c786c2336f2be
|
7
|
+
data.tar.gz: 149fcbcf5c3e48bf996db130b649b84acbfceac7f77b47a34a2db90e76c4228bedf96e9e9db6f96ace6826a17695c64c3ad0246942b5b2edd3a7d614b0211a9c
|
@@ -83,6 +83,10 @@ initializeDataTables = ->
|
|
83
83
|
$table = $(this.api().table().node())
|
84
84
|
|
85
85
|
if settings['json']
|
86
|
+
if settings['json']['effective_datatables_error']
|
87
|
+
alert("DataTable error: #{settings['json']['effective_datatables_error']}\n\nPlease refresh the page and try again")
|
88
|
+
return
|
89
|
+
|
86
90
|
if settings['json']['aggregates']
|
87
91
|
drawAggregates($table, settings['json']['aggregates'])
|
88
92
|
|
@@ -4,22 +4,18 @@ module Effective
|
|
4
4
|
|
5
5
|
# This will respond to both a GET and a POST
|
6
6
|
def show
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
render json: (@datatable.to_json rescue error_json)
|
17
|
-
else
|
18
|
-
render json: @datatable.to_json
|
19
|
-
end
|
20
|
-
}
|
21
|
-
end
|
7
|
+
begin
|
8
|
+
@datatable = find_datatable(params[:id]).try(:new) || raise('unable to find datatable')
|
9
|
+
@datatable.view = view_context
|
10
|
+
|
11
|
+
EffectiveDatatables.authorized?(self, :index, @datatable.collection_class)
|
12
|
+
|
13
|
+
render json: @datatable.to_json
|
14
|
+
rescue => e
|
15
|
+
(EffectiveDatatables.authorized?(self, :index, @datatable.try(:collection_class)) rescue false)
|
22
16
|
|
17
|
+
render json: error_json(message: e.message)
|
18
|
+
end
|
23
19
|
end
|
24
20
|
|
25
21
|
private
|
@@ -29,15 +25,16 @@ module Effective
|
|
29
25
|
id.classify.safe_constantize || id.classify.pluralize.safe_constantize
|
30
26
|
end
|
31
27
|
|
32
|
-
def error_json
|
28
|
+
def error_json(message:)
|
33
29
|
{
|
34
|
-
draw: params[:draw].to_i,
|
35
30
|
data: [],
|
31
|
+
draw: params[:draw].to_i,
|
32
|
+
effective_datatables_error: message.presence || 'unknown error',
|
36
33
|
recordsTotal: 0,
|
37
34
|
recordsFiltered: 0,
|
38
35
|
aggregates: [],
|
39
36
|
charts: {}
|
40
|
-
}
|
37
|
+
}
|
41
38
|
end
|
42
39
|
|
43
40
|
end
|
@@ -11,7 +11,9 @@ module Effective
|
|
11
11
|
|
12
12
|
def load_attributes!
|
13
13
|
if datatables_ajax_request?
|
14
|
-
raise '
|
14
|
+
raise 'expected cookie to be present' unless cookie
|
15
|
+
raise 'expected attributes cookie to be present' unless cookie[:attributes]
|
16
|
+
|
15
17
|
@attributes = cookie.delete(:attributes)
|
16
18
|
end
|
17
19
|
|
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: 3.0
|
4
|
+
version: 3.1.0
|
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: 2017-07-
|
11
|
+
date: 2017-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|