tablets 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -3
- data/app/assets/javascripts/tablets/callbacks.js.coffee +1 -0
- data/app/assets/javascripts/tablets/tablet.js.coffee +6 -0
- data/lib/tablets/data.rb +2 -1
- data/lib/tablets/tablet.rb +5 -0
- data/lib/tablets/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68012b3107a6032fcedefead6cebe9842a432400
|
4
|
+
data.tar.gz: 282ee6b15713cffb360deccf1080f35e0fe4bad7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa226722b0c938c3167197b9636eeaa94562859a044cc008be3af059326e19203639a18206e85ce2ab6b8e38fcb9e689a626215222993781661825a756d6a799
|
7
|
+
data.tar.gz: d8df45c567abda884a7c319c0b64cc7ecd4e75e89ae2676f8e3fb4a59f6cfc77a2c738e579261fa064c98910613c4339401665df9cb3200d6371061ce44d4ecb
|
data/README.md
CHANGED
@@ -74,8 +74,13 @@ Tablets.register :posts do
|
|
74
74
|
|
75
75
|
# Data relation.
|
76
76
|
relation do |params|
|
77
|
-
# Note:
|
78
|
-
|
77
|
+
# Note: users joined to enable ordering.
|
78
|
+
Post.joins(:users).where(user_id: params[:user_id])
|
79
|
+
end
|
80
|
+
|
81
|
+
# Additional data added to response.
|
82
|
+
payload do
|
83
|
+
{ hash_with: 'data' }
|
79
84
|
end
|
80
85
|
end
|
81
86
|
```
|
@@ -133,8 +138,14 @@ Called after datatable initialization.
|
|
133
138
|
Tablets.on('afterInit', function() {});
|
134
139
|
```
|
135
140
|
|
136
|
-
Called before AJAX request.
|
141
|
+
Called before AJAX request is sent.
|
137
142
|
|
138
143
|
``` javascript
|
139
144
|
Tablets.on('beforeRequest', function(params) {});
|
140
145
|
```
|
146
|
+
|
147
|
+
Called after AJAX response is received.
|
148
|
+
|
149
|
+
``` javascript
|
150
|
+
Tablets.on('afterResponse', function(data) {});
|
151
|
+
```
|
@@ -2,6 +2,7 @@ class Tablets.Tablet
|
|
2
2
|
constructor: (@element, @options, @params) ->
|
3
3
|
@initVars()
|
4
4
|
@initTable()
|
5
|
+
@initHandlers()
|
5
6
|
|
6
7
|
Tablets.set(@id, this)
|
7
8
|
|
@@ -32,6 +33,11 @@ class Tablets.Tablet
|
|
32
33
|
|
33
34
|
@trigger('afterInit')
|
34
35
|
|
36
|
+
initHandlers: ->
|
37
|
+
@element.on 'xhr.dt', (_event, _table, data) =>
|
38
|
+
@trigger('afterResponse', data)
|
39
|
+
|
40
|
+
|
35
41
|
reload: ->
|
36
42
|
@element.dataTable().fnDraw(false)
|
37
43
|
|
data/lib/tablets/data.rb
CHANGED
data/lib/tablets/tablet.rb
CHANGED
data/lib/tablets/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tablets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yevhen Shemet
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
version: '0'
|
158
158
|
requirements: []
|
159
159
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.4.
|
160
|
+
rubygems_version: 2.4.7
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: Wrapper around jquery-datatables.
|