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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13f04ec467ddd3c7e2c423f116f0251ffa29539d
4
- data.tar.gz: eec1f0cc9d7c3c6df995c94d83ff2a64e80d5976
3
+ metadata.gz: 9938215b6e112a8e5a5a381dbf833c16c0c4c131
4
+ data.tar.gz: 0a18c0529135b9602c17d7802785cbf86aceb24d
5
5
  SHA512:
6
- metadata.gz: aae04a0ddb21748cf46e4051d4453fa61e3d4fb1c350151b8b581a85b2efd88acff7b463b9e0ccc3fcdf6a546da8f2e73f611d8f5c55f994403566a0d0ca3ade
7
- data.tar.gz: d081ec36eba4928ecf5c902d03bcb51a9ab708245a16bc23b75fc0eee5c56923ba7ea7bbc0f6d46bd73425d1fa0ab9fdd59cfaa5e10fba31d2a3824ab00ff40d
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.SORT_DIRECTIONS = { 'asc': '1', 'desc': '-1' };
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
- DynatableBuilder.prototype.initialize = function() {
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: this.defaultSorts()
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
- });
@@ -1,3 +1,3 @@
1
1
  module DynatableBuilder
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
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.1
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-10-25 00:00:00.000000000 Z
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
- - rzane@bodnargroup.com
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: http://freshschedules.co
177
+ homepage: https://rubygems.org/gems/dynatable_builder
178
178
  licenses: []
179
179
  metadata: {}
180
180
  post_install_message: