datatablesassets-rails 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +84 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/datatablesassets-rails.gemspec +24 -0
- data/lib/datatablesassets-rails.rb +1 -0
- data/lib/datatablesassets/rails.rb +7 -0
- data/lib/datatablesassets/rails/engine.rb +7 -0
- data/lib/datatablesassets/rails/version.rb +5 -0
- data/vendor/assets/images/datatables/Sorting icons.psd +0 -0
- data/vendor/assets/images/datatables/favicon.ico +0 -0
- data/vendor/assets/images/datatables/sort_asc.png +0 -0
- data/vendor/assets/images/datatables/sort_asc_disabled.png +0 -0
- data/vendor/assets/images/datatables/sort_both.png +0 -0
- data/vendor/assets/images/datatables/sort_desc.png +0 -0
- data/vendor/assets/images/datatables/sort_desc_disabled.png +0 -0
- data/vendor/assets/javascript/datatables/dataTables.bootstrap.js +182 -0
- data/vendor/assets/javascript/datatables/dataTables.bootstrap.min.js +8 -0
- data/vendor/assets/javascript/datatables/dataTables.bootstrap4.js +184 -0
- data/vendor/assets/javascript/datatables/dataTables.bootstrap4.min.js +8 -0
- data/vendor/assets/javascript/datatables/dataTables.foundation.js +174 -0
- data/vendor/assets/javascript/datatables/dataTables.foundation.min.js +8 -0
- data/vendor/assets/javascript/datatables/dataTables.jqueryui.js +164 -0
- data/vendor/assets/javascript/datatables/dataTables.jqueryui.min.js +9 -0
- data/vendor/assets/javascript/datatables/dataTables.material.js +191 -0
- data/vendor/assets/javascript/datatables/dataTables.material.min.js +8 -0
- data/vendor/assets/javascript/datatables/dataTables.semanticui.js +208 -0
- data/vendor/assets/javascript/datatables/dataTables.semanticui.min.js +9 -0
- data/vendor/assets/javascript/datatables/dataTables.uikit.js +176 -0
- data/vendor/assets/javascript/datatables/dataTables.uikit.min.js +8 -0
- data/vendor/assets/javascript/datatables/jquery.dataTables.js +15278 -0
- data/vendor/assets/javascript/datatables/jquery.dataTables.min.js +166 -0
- data/vendor/assets/stylesheets/datatables/dataTables.bootstrap.css +185 -0
- data/vendor/assets/stylesheets/datatables/dataTables.bootstrap.min.css +1 -0
- data/vendor/assets/stylesheets/datatables/dataTables.bootstrap4.css +193 -0
- data/vendor/assets/stylesheets/datatables/dataTables.bootstrap4.min.css +1 -0
- data/vendor/assets/stylesheets/datatables/dataTables.foundation.css +116 -0
- data/vendor/assets/stylesheets/datatables/dataTables.foundation.min.css +1 -0
- data/vendor/assets/stylesheets/datatables/dataTables.jqueryui.css +481 -0
- data/vendor/assets/stylesheets/datatables/dataTables.jqueryui.min.css +1 -0
- data/vendor/assets/stylesheets/datatables/dataTables.material.css +87 -0
- data/vendor/assets/stylesheets/datatables/dataTables.material.min.css +1 -0
- data/vendor/assets/stylesheets/datatables/dataTables.semanticui.css +103 -0
- data/vendor/assets/stylesheets/datatables/dataTables.semanticui.min.css +1 -0
- data/vendor/assets/stylesheets/datatables/dataTables.uikit.css +146 -0
- data/vendor/assets/stylesheets/datatables/dataTables.uikit.min.css +1 -0
- data/vendor/assets/stylesheets/datatables/jquery.dataTables.css +452 -0
- data/vendor/assets/stylesheets/datatables/jquery.dataTables.min.css +1 -0
- data/vendor/assets/stylesheets/datatables/jquery.dataTables_themeroller.css +417 -0
- metadata +127 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bed89b3ede67d2990fd2874a8274317b161d0231
|
4
|
+
data.tar.gz: abb0f67a35e89f77e259a140fb91f7b2c73bbdef
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0bff096c31048b3e491c1924e95c46f559f7cce7b8b2209b331eeb5326d6f7881d92945026ad1bd872a118bcdd42ebb671e57f88d57d469e565634d308e792d6
|
7
|
+
data.tar.gz: 5fe39e95ff39b65880b75e272d63a56d84eaf227865c50ff36baa805b3b3065935d89de020ea1ac28e6065ef880ca12c9ba8d48777ed8f56289d13d21d5aeeab
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at bartosz.grzesiak@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Bartosz Grzesiak
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# datatablesassets-rails [![Gem Version](https://badge.fury.io/rb/datatablesassets-rails.svg)](https://badge.fury.io/rb/datatablesassets-rails)
|
2
|
+
|
3
|
+
The `datatablesassets-rails` gem packages the [jQuery DataTables](http://www.datatables.net/) assets for easy inclusion
|
4
|
+
in an Rails application using assets pipeline.
|
5
|
+
|
6
|
+
## Used Versinion
|
7
|
+
[DataTables version 1.10.12](https://github.com/DataTables/DataTables/tree/1.10.12)
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
To use this gem you need [jQuery](http://jquery.com/) in your application javascript.
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'datatablesassets-rails'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install datatablesassets-rails
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
### JavaScript
|
28
|
+
|
29
|
+
Include the javascript part:
|
30
|
+
|
31
|
+
For Coffeescript
|
32
|
+
|
33
|
+
#= require datatables/jquery.dataTables
|
34
|
+
|
35
|
+
For JavaScript
|
36
|
+
|
37
|
+
//= require datatables/jquery.dataTables
|
38
|
+
|
39
|
+
Make sure you add the line after the inclusion of jQuery
|
40
|
+
|
41
|
+
### Stylesheets
|
42
|
+
|
43
|
+
Include the style part:
|
44
|
+
|
45
|
+
@import "datatables/jquery.dataTables";
|
46
|
+
|
47
|
+
## Initialize
|
48
|
+
### Example for Bootsrtap
|
49
|
+
|
50
|
+
app/assets/javascript/applicataion.js
|
51
|
+
|
52
|
+
```javascript
|
53
|
+
|
54
|
+
//= require jquery
|
55
|
+
//= require jquery_ujs
|
56
|
+
//= require bootstrap-sprockets
|
57
|
+
//= require datatables/jquery.dataTables
|
58
|
+
//= require datatables/dataTables.bootstrap
|
59
|
+
|
60
|
+
$(document).ready(function() {
|
61
|
+
$('table').DataTable();
|
62
|
+
});
|
63
|
+
|
64
|
+
````
|
65
|
+
|
66
|
+
app/assets/stylesheets/style.scss
|
67
|
+
|
68
|
+
```stylesheet
|
69
|
+
@import "bootstrap-sprockets";
|
70
|
+
@import "datatables/dataTables.bootstrap";
|
71
|
+
```
|
72
|
+
|
73
|
+
## Contributing
|
74
|
+
|
75
|
+
1. [Fork it]( https://github.com/wendrowycz/datatablesassets-rails)
|
76
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
77
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
78
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
79
|
+
5. Create new Pull Request
|
80
|
+
|
81
|
+
## License
|
82
|
+
|
83
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
84
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "datatablesassets/rails"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'datatablesassets/rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "datatablesassets-rails"
|
8
|
+
spec.version = Datatablesassets::Rails::VERSION
|
9
|
+
spec.authors = ["Bartosz Grzesiak"]
|
10
|
+
spec.email = ["bartosz.grzesiak@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{DataTables plug-in for jQuery.}
|
13
|
+
spec.description = %q{DataTables is a table enhancing plug-in for the jQuery Javascript library, adding sorting, paging and filtering abilities to plain HTML tables with minimal effort.}
|
14
|
+
spec.homepage = "https://github.com/wendrowycz/datatablesassets-rails"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'datatablesassets/rails'
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,182 @@
|
|
1
|
+
/*! DataTables Bootstrap 3 integration
|
2
|
+
* ©2011-2015 SpryMedia Ltd - datatables.net/license
|
3
|
+
*/
|
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( factory ){
|
14
|
+
if ( typeof define === 'function' && define.amd ) {
|
15
|
+
// AMD
|
16
|
+
define( ['jquery', 'datatables.net'], function ( $ ) {
|
17
|
+
return factory( $, window, document );
|
18
|
+
} );
|
19
|
+
}
|
20
|
+
else if ( typeof exports === 'object' ) {
|
21
|
+
// CommonJS
|
22
|
+
module.exports = function (root, $) {
|
23
|
+
if ( ! root ) {
|
24
|
+
root = window;
|
25
|
+
}
|
26
|
+
|
27
|
+
if ( ! $ || ! $.fn.dataTable ) {
|
28
|
+
// Require DataTables, which attaches to jQuery, including
|
29
|
+
// jQuery if needed and have a $ property so we can access the
|
30
|
+
// jQuery object that is used
|
31
|
+
$ = require('datatables.net')(root, $).$;
|
32
|
+
}
|
33
|
+
|
34
|
+
return factory( $, root, root.document );
|
35
|
+
};
|
36
|
+
}
|
37
|
+
else {
|
38
|
+
// Browser
|
39
|
+
factory( jQuery, window, document );
|
40
|
+
}
|
41
|
+
}(function( $, window, document, undefined ) {
|
42
|
+
'use strict';
|
43
|
+
var DataTable = $.fn.dataTable;
|
44
|
+
|
45
|
+
|
46
|
+
/* Set the defaults for DataTables initialisation */
|
47
|
+
$.extend( true, DataTable.defaults, {
|
48
|
+
dom:
|
49
|
+
"<'row'<'col-sm-6'l><'col-sm-6'f>>" +
|
50
|
+
"<'row'<'col-sm-12'tr>>" +
|
51
|
+
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
52
|
+
renderer: 'bootstrap'
|
53
|
+
} );
|
54
|
+
|
55
|
+
|
56
|
+
/* Default class modification */
|
57
|
+
$.extend( DataTable.ext.classes, {
|
58
|
+
sWrapper: "dataTables_wrapper form-inline dt-bootstrap",
|
59
|
+
sFilterInput: "form-control input-sm",
|
60
|
+
sLengthSelect: "form-control input-sm",
|
61
|
+
sProcessing: "dataTables_processing panel panel-default"
|
62
|
+
} );
|
63
|
+
|
64
|
+
|
65
|
+
/* Bootstrap paging button renderer */
|
66
|
+
DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) {
|
67
|
+
var api = new DataTable.Api( settings );
|
68
|
+
var classes = settings.oClasses;
|
69
|
+
var lang = settings.oLanguage.oPaginate;
|
70
|
+
var aria = settings.oLanguage.oAria.paginate || {};
|
71
|
+
var btnDisplay, btnClass, counter=0;
|
72
|
+
|
73
|
+
var attach = function( container, buttons ) {
|
74
|
+
var i, ien, node, button;
|
75
|
+
var clickHandler = function ( e ) {
|
76
|
+
e.preventDefault();
|
77
|
+
if ( !$(e.currentTarget).hasClass('disabled') && api.page() != e.data.action ) {
|
78
|
+
api.page( e.data.action ).draw( 'page' );
|
79
|
+
}
|
80
|
+
};
|
81
|
+
|
82
|
+
for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
|
83
|
+
button = buttons[i];
|
84
|
+
|
85
|
+
if ( $.isArray( button ) ) {
|
86
|
+
attach( container, button );
|
87
|
+
}
|
88
|
+
else {
|
89
|
+
btnDisplay = '';
|
90
|
+
btnClass = '';
|
91
|
+
|
92
|
+
switch ( button ) {
|
93
|
+
case 'ellipsis':
|
94
|
+
btnDisplay = '…';
|
95
|
+
btnClass = 'disabled';
|
96
|
+
break;
|
97
|
+
|
98
|
+
case 'first':
|
99
|
+
btnDisplay = lang.sFirst;
|
100
|
+
btnClass = button + (page > 0 ?
|
101
|
+
'' : ' disabled');
|
102
|
+
break;
|
103
|
+
|
104
|
+
case 'previous':
|
105
|
+
btnDisplay = lang.sPrevious;
|
106
|
+
btnClass = button + (page > 0 ?
|
107
|
+
'' : ' disabled');
|
108
|
+
break;
|
109
|
+
|
110
|
+
case 'next':
|
111
|
+
btnDisplay = lang.sNext;
|
112
|
+
btnClass = button + (page < pages-1 ?
|
113
|
+
'' : ' disabled');
|
114
|
+
break;
|
115
|
+
|
116
|
+
case 'last':
|
117
|
+
btnDisplay = lang.sLast;
|
118
|
+
btnClass = button + (page < pages-1 ?
|
119
|
+
'' : ' disabled');
|
120
|
+
break;
|
121
|
+
|
122
|
+
default:
|
123
|
+
btnDisplay = button + 1;
|
124
|
+
btnClass = page === button ?
|
125
|
+
'active' : '';
|
126
|
+
break;
|
127
|
+
}
|
128
|
+
|
129
|
+
if ( btnDisplay ) {
|
130
|
+
node = $('<li>', {
|
131
|
+
'class': classes.sPageButton+' '+btnClass,
|
132
|
+
'id': idx === 0 && typeof button === 'string' ?
|
133
|
+
settings.sTableId +'_'+ button :
|
134
|
+
null
|
135
|
+
} )
|
136
|
+
.append( $('<a>', {
|
137
|
+
'href': '#',
|
138
|
+
'aria-controls': settings.sTableId,
|
139
|
+
'aria-label': aria[ button ],
|
140
|
+
'data-dt-idx': counter,
|
141
|
+
'tabindex': settings.iTabIndex
|
142
|
+
} )
|
143
|
+
.html( btnDisplay )
|
144
|
+
)
|
145
|
+
.appendTo( container );
|
146
|
+
|
147
|
+
settings.oApi._fnBindAction(
|
148
|
+
node, {action: button}, clickHandler
|
149
|
+
);
|
150
|
+
|
151
|
+
counter++;
|
152
|
+
}
|
153
|
+
}
|
154
|
+
}
|
155
|
+
};
|
156
|
+
|
157
|
+
// IE9 throws an 'unknown error' if document.activeElement is used
|
158
|
+
// inside an iframe or frame.
|
159
|
+
var activeEl;
|
160
|
+
|
161
|
+
try {
|
162
|
+
// Because this approach is destroying and recreating the paging
|
163
|
+
// elements, focus is lost on the select button which is bad for
|
164
|
+
// accessibility. So we want to restore focus once the draw has
|
165
|
+
// completed
|
166
|
+
activeEl = $(host).find(document.activeElement).data('dt-idx');
|
167
|
+
}
|
168
|
+
catch (e) {}
|
169
|
+
|
170
|
+
attach(
|
171
|
+
$(host).empty().html('<ul class="pagination"/>').children('ul'),
|
172
|
+
buttons
|
173
|
+
);
|
174
|
+
|
175
|
+
if ( activeEl ) {
|
176
|
+
$(host).find( '[data-dt-idx='+activeEl+']' ).focus();
|
177
|
+
}
|
178
|
+
};
|
179
|
+
|
180
|
+
|
181
|
+
return DataTable;
|
182
|
+
}));
|