dynatable_builder 0.0.1 → 0.0.2
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 +4 -4
- data/app/assets/javascripts/dynatable_builder.js +27 -19
- data/lib/dynatable_builder/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9938215b6e112a8e5a5a381dbf833c16c0c4c131
|
4
|
+
data.tar.gz: 0a18c0529135b9602c17d7802785cbf86aceb24d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6be82296fff3962e08bf89991c202eb139d8d190f3ec652baff7d72224e13030bb2758747730ffcfcbf926816f62e37e339d998576c8629692e6a392cd75e896
|
7
|
+
data.tar.gz: 06b6b330d3d60285c0aadec5cf6fc122d1318e14dfc70e20a210eb3331d103da70610b67d2d559e8e4d142d5ed6ec84ac85a52541210e2396a52f5d3f1e67543
|
@@ -3,32 +3,40 @@ function DynatableBuilder(element) {
|
|
3
3
|
this.sortDirection = this.table.data('order') || 'asc';
|
4
4
|
this.sortColumn = this.table.data('sort');
|
5
5
|
this.source = this.table.data('source') || document.URL;
|
6
|
+
}
|
7
|
+
|
8
|
+
DynatableBuilder.SORT_DIRECTIONS = {
|
9
|
+
'asc': '1',
|
10
|
+
'desc': '-1'
|
6
11
|
};
|
7
12
|
|
8
|
-
DynatableBuilder.
|
13
|
+
DynatableBuilder.initialize = function(options) {
|
14
|
+
return $('.dynatable').map(function() {
|
15
|
+
return new DynatableBuilder(this).initialize(options);
|
16
|
+
});
|
17
|
+
};
|
18
|
+
|
19
|
+
DynatableBuilder.prototype.initialize = function(options) {
|
20
|
+
var defaults = this.defaultOptions();
|
21
|
+
var allOptions = $.extend({}, defaults, options);
|
22
|
+
return this.table.dynatable(allOptions);
|
23
|
+
};
|
24
|
+
|
25
|
+
DynatableBuilder.prototype.defaultOptions = function() {
|
26
|
+
var sorts = {};
|
27
|
+
|
28
|
+
if (this.sortColumn) {
|
29
|
+
sorts[this.sortColumn] =
|
30
|
+
DynatableBuilder.SORT_DIRECTIONS[this.sortDirection];
|
31
|
+
}
|
9
32
|
|
10
|
-
|
11
|
-
this.table.dynatable({
|
33
|
+
return {
|
12
34
|
dataset: {
|
13
35
|
ajax: true,
|
14
36
|
ajaxUrl: this.source,
|
15
37
|
ajaxOnLoad: true,
|
16
38
|
records: [],
|
17
|
-
sorts:
|
39
|
+
sorts: sorts
|
18
40
|
}
|
19
|
-
}
|
41
|
+
};
|
20
42
|
};
|
21
|
-
|
22
|
-
DynatableBuilder.prototype.defaultSorts = function() {
|
23
|
-
var sorts = {};
|
24
|
-
if (this.sortColumn) {
|
25
|
-
sorts[this.sortColumn] = DynatableBuilder.SORT_DIRECTIONS[this.sortDirection];
|
26
|
-
}
|
27
|
-
return sorts;
|
28
|
-
};
|
29
|
-
|
30
|
-
$(function() {
|
31
|
-
$('.dynatable').each(function() {
|
32
|
-
new DynatableBuilder(this).initialize();
|
33
|
-
});
|
34
|
-
});
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynatable_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ray Zane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -153,7 +153,7 @@ dependencies:
|
|
153
153
|
description: A DSL for generating AJAX tables with sorting/searching/pagination using
|
154
154
|
jQuery Dynatables.js.
|
155
155
|
email:
|
156
|
-
-
|
156
|
+
- raymondzane@gmail.com
|
157
157
|
executables: []
|
158
158
|
extensions: []
|
159
159
|
extra_rdoc_files: []
|
@@ -174,7 +174,7 @@ files:
|
|
174
174
|
- lib/generators/templates/table.rb
|
175
175
|
- vendor/assets/javascripts/jquery.dynatable.js
|
176
176
|
- vendor/assets/stylesheets/jquery.dynatable.css
|
177
|
-
homepage:
|
177
|
+
homepage: https://rubygems.org/gems/dynatable_builder
|
178
178
|
licenses: []
|
179
179
|
metadata: {}
|
180
180
|
post_install_message:
|