jquery-datatables-rails 2.1.10.0.3 → 2.2.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: ad97f3f08a32362f33f1d8e8b1e8e811f8f72829
4
- data.tar.gz: 097c1e9ac9e7161293b4d7063db60cce7d651695
3
+ metadata.gz: 75465d2c0f1b413b1bb7d6ddc2eb38e5d782ca4c
4
+ data.tar.gz: 7506e320a80d4610e4ec0381f44b01d759057b5a
5
5
  SHA512:
6
- metadata.gz: a43fa1c591216d51b72f9a5aa8311c26ce09a13aa8b15537b5301d75b52612701ab2ca2ac692151191f71671c739b0836166f724985ddec96d15372e4168a193
7
- data.tar.gz: b7884dd1b9d26a52547cacd30b99255a2ce62d038bb24d13102988da24531a5d90e3be9894444c3d9dbd86d655960f238e8e7af9156621fcbe15a9a453922992
6
+ metadata.gz: 30cc8f3195633431d8700c192ee3454924a050b595a85fe0bd5e28b57610120e66f8aefbc1cf9ee62d63bef7a66cfae144b4c646c635015be10f7b2b2e8caf82
7
+ data.tar.gz: 079ea5d271a802e06405cef28c55ca9743a95a3518c15cb3a362e22c36f12e9c30de97ecc649a9b3751759715113e6f119c40a150f8cbc25572f9e159817b6ad
@@ -1,125 +1,140 @@
1
- /* Set the defaults for DataTables initialisation */
2
- $.extend( true, $.fn.dataTable.defaults, {
3
- "sDom": "<'row'<'col-xs-6'l><'col-xs-6'f>r>t<'row'<'col-xs-6'i><'col-xs-6'p>>",
4
- "sPaginationType": "bootstrap",
5
- "oLanguage": {
6
- "sLengthMenu": "_MENU_ records per page"
7
- }
8
- } );
1
+ /*! DataTables Bootstrap integration
2
+ * ©2011-2014 SpryMedia Ltd - datatables.net/license
3
+ */
9
4
 
5
+ /**
6
+ * DataTables integration for Bootstrap 3. This requires Bootstrap 3 and
7
+ * DataTables 1.10 or newer.
8
+ *
9
+ * This file sets the defaults and adds options to DataTables to style its
10
+ * controls using Bootstrap. See http://datatables.net/manual/styling/bootstrap
11
+ * for further information.
12
+ */
13
+ (function(window, document, undefined){
10
14
 
15
+ var factory = function( $, DataTable ) {
16
+ "use strict";
11
17
 
12
18
 
13
- /* Default class modification */
14
- $.extend( $.fn.dataTableExt.oStdClasses, {
15
- "sWrapper": "dataTables_wrapper form-inline",
16
- "sFilterInput": "form-control input-sm",
17
- "sLengthSelect": "form-control input-sm"
19
+ /* Set the defaults for DataTables initialisation */
20
+ $.extend( true, DataTable.defaults, {
21
+ dom:
22
+ "<'row'<'col-xs-6'l><'col-xs-6'f>r>"+
23
+ "t"+
24
+ "<'row'<'col-xs-6'i><'col-xs-6'p>>",
25
+ renderer: 'bootstrap'
18
26
  } );
19
27
 
20
28
 
21
- /* API method to get paging information */
22
- $.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings )
23
- {
24
- return {
25
- "iStart": oSettings._iDisplayStart,
26
- "iEnd": oSettings.fnDisplayEnd(),
27
- "iLength": oSettings._iDisplayLength,
28
- "iTotal": oSettings.fnRecordsTotal(),
29
- "iFilteredTotal": oSettings.fnRecordsDisplay(),
30
- "iPage": oSettings._iDisplayLength === -1 ?
31
- 0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ),
32
- "iTotalPages": oSettings._iDisplayLength === -1 ?
33
- 0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength )
34
- };
35
- };
36
-
29
+ /* Default class modification */
30
+ $.extend( DataTable.ext.classes, {
31
+ sWrapper: "dataTables_wrapper form-inline dt-bootstrap",
32
+ sFilterInput: "form-control input-sm",
33
+ sLengthSelect: "form-control input-sm"
34
+ } );
37
35
 
38
- /* Bootstrap style pagination control */
39
- $.extend( $.fn.dataTableExt.oPagination, {
40
- "bootstrap": {
41
- "fnInit": function( oSettings, nPaging, fnDraw ) {
42
- var oLang = oSettings.oLanguage.oPaginate;
43
- var fnClickHandler = function ( e ) {
44
- e.preventDefault();
45
- if ( oSettings.oApi._fnPageChange(oSettings, e.data.action) ) {
46
- fnDraw( oSettings );
47
- }
48
- };
49
-
50
- $(nPaging).append(
51
- '<ul class="pagination">'+
52
- '<li class="prev disabled"><a href="#">&larr; '+oLang.sPrevious+'</a></li>'+
53
- '<li class="next disabled"><a href="#">'+oLang.sNext+' &rarr; </a></li>'+
54
- '</ul>'
55
- );
56
- var els = $('a', nPaging);
57
- $(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler );
58
- $(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler );
59
- },
60
36
 
61
- "fnUpdate": function ( oSettings, fnDraw ) {
62
- var iListLength = 5;
63
- var oPaging = oSettings.oInstance.fnPagingInfo();
64
- var an = oSettings.aanFeatures.p;
65
- var i, ien, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2);
37
+ /* Bootstrap paging button renderer */
38
+ DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) {
39
+ var api = new DataTable.Api( settings );
40
+ var classes = settings.oClasses;
41
+ var lang = settings.oLanguage.oPaginate;
42
+ var btnDisplay, btnClass;
66
43
 
67
- if ( oPaging.iTotalPages < iListLength) {
68
- iStart = 1;
69
- iEnd = oPaging.iTotalPages;
70
- }
71
- else if ( oPaging.iPage <= iHalf ) {
72
- iStart = 1;
73
- iEnd = iListLength;
74
- } else if ( oPaging.iPage >= (oPaging.iTotalPages-iHalf) ) {
75
- iStart = oPaging.iTotalPages - iListLength + 1;
76
- iEnd = oPaging.iTotalPages;
77
- } else {
78
- iStart = oPaging.iPage - iHalf + 1;
79
- iEnd = iStart + iListLength - 1;
44
+ var attach = function( container, buttons ) {
45
+ var i, ien, node, button;
46
+ var clickHandler = function ( e ) {
47
+ e.preventDefault();
48
+ if ( e.data.action !== 'ellipsis' ) {
49
+ api.page( e.data.action ).draw( false );
80
50
  }
51
+ };
81
52
 
82
- for ( i=0, ien=an.length ; i<ien ; i++ ) {
83
- // Remove the middle elements
84
- $('li:gt(0)', an[i]).filter(':not(:last)').remove();
85
-
86
- // Add the new list items and their event handlers
87
- for ( j=iStart ; j<=iEnd ; j++ ) {
88
- sClass = (j==oPaging.iPage+1) ? 'class="active"' : '';
89
- $('<li '+sClass+'><a href="#">'+j+'</a></li>')
90
- .insertBefore( $('li:last', an[i])[0] )
91
- .bind('click', function (e) {
92
- e.preventDefault();
93
- oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength;
94
- fnDraw( oSettings );
95
- } );
96
- }
53
+ for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
54
+ button = buttons[i];
97
55
 
98
- // Add / remove disabled classes from the static elements
99
- if ( oPaging.iPage === 0 ) {
100
- $('li:first', an[i]).addClass('disabled');
101
- } else {
102
- $('li:first', an[i]).removeClass('disabled');
56
+ if ( $.isArray( button ) ) {
57
+ attach( container, button );
58
+ }
59
+ else {
60
+ btnDisplay = '';
61
+ btnClass = '';
62
+
63
+ switch ( button ) {
64
+ case 'ellipsis':
65
+ btnDisplay = '&hellip;';
66
+ btnClass = 'disabled';
67
+ break;
68
+
69
+ case 'first':
70
+ btnDisplay = lang.sFirst;
71
+ btnClass = button + (page > 0 ?
72
+ '' : ' disabled');
73
+ break;
74
+
75
+ case 'previous':
76
+ btnDisplay = lang.sPrevious;
77
+ btnClass = button + (page > 0 ?
78
+ '' : ' disabled');
79
+ break;
80
+
81
+ case 'next':
82
+ btnDisplay = lang.sNext;
83
+ btnClass = button + (page < pages-1 ?
84
+ '' : ' disabled');
85
+ break;
86
+
87
+ case 'last':
88
+ btnDisplay = lang.sLast;
89
+ btnClass = button + (page < pages-1 ?
90
+ '' : ' disabled');
91
+ break;
92
+
93
+ default:
94
+ btnDisplay = button + 1;
95
+ btnClass = page === button ?
96
+ 'active' : '';
97
+ break;
103
98
  }
104
99
 
105
- if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) {
106
- $('li:last', an[i]).addClass('disabled');
107
- } else {
108
- $('li:last', an[i]).removeClass('disabled');
100
+ if ( btnDisplay ) {
101
+ node = $('<li>', {
102
+ 'class': classes.sPageButton+' '+btnClass,
103
+ 'aria-controls': settings.sTableId,
104
+ 'tabindex': settings.iTabIndex,
105
+ 'id': idx === 0 && typeof button === 'string' ?
106
+ settings.sTableId +'_'+ button :
107
+ null
108
+ } )
109
+ .append( $('<a>', {
110
+ 'href': '#'
111
+ } )
112
+ .html( btnDisplay )
113
+ )
114
+ .appendTo( container );
115
+
116
+ settings.oApi._fnBindAction(
117
+ node, {action: button}, clickHandler
118
+ );
109
119
  }
110
120
  }
111
121
  }
112
- }
113
- } );
122
+ };
123
+
124
+ attach(
125
+ $(host).empty().html('<ul class="pagination"/>').children('ul'),
126
+ buttons
127
+ );
128
+ };
114
129
 
115
130
 
116
131
  /*
117
132
  * TableTools Bootstrap compatibility
118
133
  * Required TableTools 2.1+
119
134
  */
120
- if ( $.fn.DataTable.TableTools ) {
135
+ if ( DataTable.TableTools ) {
121
136
  // Set the classes that TableTools uses to something suitable for Bootstrap
122
- $.extend( true, $.fn.DataTable.TableTools.classes, {
137
+ $.extend( true, DataTable.TableTools.classes, {
123
138
  "container": "DTTT btn-group",
124
139
  "buttons": {
125
140
  "normal": "btn btn-default",
@@ -140,8 +155,8 @@ if ( $.fn.DataTable.TableTools ) {
140
155
  }
141
156
  } );
142
157
 
143
- // Have the collection use a bootstrap compatible dropdown
144
- $.extend( true, $.fn.DataTable.TableTools.DEFAULTS.oTags, {
158
+ // Have the collection use a bootstrap compatible drop down
159
+ $.extend( true, DataTable.TableTools.DEFAULTS.oTags, {
145
160
  "collection": {
146
161
  "container": "ul",
147
162
  "button": "li",
@@ -150,3 +165,21 @@ if ( $.fn.DataTable.TableTools ) {
150
165
  } );
151
166
  }
152
167
 
168
+ }; // /factory
169
+
170
+
171
+ // Define as an AMD module if possible
172
+ if ( typeof define === 'function' && define.amd ) {
173
+ define( ['jquery', 'datatables'], factory );
174
+ }
175
+ else if ( typeof exports === 'object' ) {
176
+ // Node/CommonJS
177
+ factory( require('jquery'), require('datatables') );
178
+ }
179
+ else if ( jQuery ) {
180
+ // Otherwise simply initialise as normal, stopping multiple evaluation
181
+ factory( jQuery, jQuery.fn.dataTable );
182
+ }
183
+
184
+
185
+ })(window, document);
@@ -27,10 +27,10 @@ div.dataTables_paginate {
27
27
  }
28
28
 
29
29
  div.dataTables_paginate ul.pagination {
30
- margin: 2px;
30
+ margin: 2px 0;
31
+ white-space: nowrap;
31
32
  }
32
33
 
33
- table.dataTable,
34
34
  table.dataTable td,
35
35
  table.dataTable th {
36
36
  -webkit-box-sizing: content-box;
@@ -61,6 +61,11 @@ table.dataTable thead .sorting_desc { background: image-url('dataTables/sort_des
61
61
  table.dataTable thead .sorting_asc_disabled { background: image-url('dataTables/sort_asc_disabled.png') no-repeat center right; }
62
62
  table.dataTable thead .sorting_desc_disabled { background: image-url('dataTables/sort_desc_disabled.png') no-repeat center right; }
63
63
 
64
+ table.dataTable thead > tr > th {
65
+ padding-left: 18px;
66
+ padding-right: 18px;
67
+ }
68
+
64
69
  table.dataTable th:active {
65
70
  outline: none;
66
71
  }
@@ -80,6 +85,7 @@ div.dataTables_scrollHead table thead tr:last-child td:first-child {
80
85
 
81
86
  div.dataTables_scrollBody table {
82
87
  border-top: none;
88
+ margin-top: 0 !important;
83
89
  margin-bottom: 0 !important;
84
90
  }
85
91
 
@@ -89,9 +95,35 @@ div.dataTables_scrollBody tbody tr:first-child td {
89
95
  }
90
96
 
91
97
  div.dataTables_scrollFoot table {
98
+ margin-top: 0 !important;
92
99
  border-top: none;
93
100
  }
94
101
 
102
+ /* Frustratingly the border-collapse:collapse used by Bootstrap makes the column
103
+ width calculations when using scrolling impossible to align columns. We have
104
+ to use separate
105
+ */
106
+ table.table-bordered.dataTable {
107
+ border-collapse: separate !important;
108
+ }
109
+ table.table-bordered thead th,
110
+ table.table-bordered thead td {
111
+ border-left-width: 0;
112
+ border-top-width: 0;
113
+ }
114
+ table.table-bordered tbody th,
115
+ table.table-bordered tbody td {
116
+ border-left-width: 0;
117
+ border-bottom-width: 0;
118
+ }
119
+ table.table-bordered th:last-child,
120
+ table.table-bordered td:last-child {
121
+ border-right-width: 0;
122
+ }
123
+ div.dataTables_scrollHead table.table-bordered {
124
+ border-bottom-width: 0;
125
+ }
126
+
95
127
 
96
128
 
97
129
 
@@ -149,7 +181,7 @@ ul.DTTT_dropdown.dropdown-menu li:hover a {
149
181
  }
150
182
 
151
183
  div.DTTT_collection_background {
152
- z-index: 2002;
184
+ z-index: 2002;
153
185
  }
154
186
 
155
187
  /* TableTools information display */
@@ -171,6 +203,26 @@ div.DTTT_print_info p {
171
203
  line-height: 20px;
172
204
  }
173
205
 
206
+ div.dataTables_processing {
207
+ position: absolute;
208
+ top: 50%;
209
+ left: 50%;
210
+ width: 100%;
211
+ height: 40px;
212
+ margin-left: -50%;
213
+ margin-top: -25px;
214
+ padding-top: 20px;
215
+ text-align: center;
216
+ font-size: 1.2em;
217
+ background-color: white;
218
+ background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255,255,255,0)), color-stop(25%, rgba(255,255,255,0.9)), color-stop(75%, rgba(255,255,255,0.9)), color-stop(100%, rgba(255,255,255,0)));
219
+ background: -webkit-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);
220
+ background: -moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);
221
+ background: -ms-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);
222
+ background: -o-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);
223
+ background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);
224
+ }
225
+
174
226
 
175
227
 
176
228
  /*
@@ -182,8 +234,9 @@ div.DTFC_RightHeadWrapper table,
182
234
  div.DTFC_RightFootWrapper table,
183
235
  table.DTFC_Cloned tr.even {
184
236
  background-color: white;
237
+ margin-bottom: 0;
185
238
  }
186
-
239
+
187
240
  div.DTFC_RightHeadWrapper table ,
188
241
  div.DTFC_LeftHeadWrapper table {
189
242
  margin-bottom: 0 !important;
@@ -191,7 +244,7 @@ div.DTFC_LeftHeadWrapper table {
191
244
  border-bottom-left-radius: 0 !important;
192
245
  border-bottom-right-radius: 0 !important;
193
246
  }
194
-
247
+
195
248
  div.DTFC_RightHeadWrapper table thead tr:last-child th:first-child,
196
249
  div.DTFC_RightHeadWrapper table thead tr:last-child td:first-child,
197
250
  div.DTFC_LeftHeadWrapper table thead tr:last-child th:first-child,
@@ -199,22 +252,29 @@ div.DTFC_LeftHeadWrapper table thead tr:last-child td:first-child {
199
252
  border-bottom-left-radius: 0 !important;
200
253
  border-bottom-right-radius: 0 !important;
201
254
  }
202
-
255
+
203
256
  div.DTFC_RightBodyWrapper table,
204
257
  div.DTFC_LeftBodyWrapper table {
205
258
  border-top: none;
206
- margin-bottom: 0 !important;
259
+ margin: 0 !important;
207
260
  }
208
-
261
+
209
262
  div.DTFC_RightBodyWrapper tbody tr:first-child th,
210
263
  div.DTFC_RightBodyWrapper tbody tr:first-child td,
211
264
  div.DTFC_LeftBodyWrapper tbody tr:first-child th,
212
265
  div.DTFC_LeftBodyWrapper tbody tr:first-child td {
213
266
  border-top: none;
214
267
  }
215
-
268
+
216
269
  div.DTFC_RightFootWrapper table,
217
270
  div.DTFC_LeftFootWrapper table {
218
271
  border-top: none;
219
272
  }
220
273
 
274
+
275
+ /*
276
+ * FixedHeader styles
277
+ */
278
+ div.FixedHeader_Cloned table {
279
+ margin: 0 !important
280
+ }
@@ -1,7 +1,7 @@
1
1
  module Jquery
2
2
  module Datatables
3
3
  module Rails
4
- VERSION = "2.1.10.0.3"
4
+ VERSION = "2.2.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-datatables-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.10.0.3
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin Wenglewski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-11 00:00:00.000000000 Z
11
+ date: 2014-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jquery-rails
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  version: '0'
146
146
  requirements: []
147
147
  rubyforge_project:
148
- rubygems_version: 2.3.0
148
+ rubygems_version: 2.2.2
149
149
  signing_key:
150
150
  specification_version: 4
151
151
  summary: jquery datatables for rails