jquery-datatables 1.10.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +23 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +27 -0
  5. data/README.md +118 -0
  6. data/Rakefile +166 -0
  7. data/app/assets/images/datatables/sort_asc.png +0 -0
  8. data/app/assets/images/datatables/sort_asc_disabled.png +0 -0
  9. data/app/assets/images/datatables/sort_both.png +0 -0
  10. data/app/assets/images/datatables/sort_desc.png +0 -0
  11. data/app/assets/images/datatables/sort_desc_disabled.png +0 -0
  12. data/app/assets/javascripts/datatables/dataTables.bootstrap.js +182 -0
  13. data/app/assets/javascripts/datatables/dataTables.bootstrap4.js +184 -0
  14. data/app/assets/javascripts/datatables/dataTables.foundation.js +174 -0
  15. data/app/assets/javascripts/datatables/dataTables.jqueryui.js +164 -0
  16. data/app/assets/javascripts/datatables/dataTables.material.js +191 -0
  17. data/app/assets/javascripts/datatables/dataTables.semanticui.js +208 -0
  18. data/app/assets/javascripts/datatables/dataTables.uikit.js +176 -0
  19. data/app/assets/javascripts/datatables/extensions/AutoFill/autoFill.bootstrap.js +43 -0
  20. data/app/assets/javascripts/datatables/extensions/AutoFill/autoFill.bootstrap4.js +43 -0
  21. data/app/assets/javascripts/datatables/extensions/AutoFill/autoFill.foundation.js +43 -0
  22. data/app/assets/javascripts/datatables/extensions/AutoFill/autoFill.jqueryui.js +43 -0
  23. data/app/assets/javascripts/datatables/extensions/AutoFill/autoFill.semanticui.js +43 -0
  24. data/app/assets/javascripts/datatables/extensions/AutoFill/dataTables.autoFill.js +1036 -0
  25. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.bootstrap.js +68 -0
  26. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.bootstrap4.js +60 -0
  27. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.colVis.js +199 -0
  28. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.flash.js +1325 -0
  29. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.foundation.js +85 -0
  30. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.html5.js +1322 -0
  31. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.jqueryui.js +62 -0
  32. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.print.js +172 -0
  33. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.semanticui.js +57 -0
  34. data/app/assets/javascripts/datatables/extensions/Buttons/dataTables.buttons.js +1634 -0
  35. data/app/assets/javascripts/datatables/extensions/ColReorder/dataTables.colReorder.js +1335 -0
  36. data/app/assets/javascripts/datatables/extensions/FixedColumns/dataTables.fixedColumns.js +1623 -0
  37. data/app/assets/javascripts/datatables/extensions/FixedHeader/dataTables.fixedHeader.js +672 -0
  38. data/app/assets/javascripts/datatables/extensions/KeyTable/dataTables.keyTable.js +883 -0
  39. data/app/assets/javascripts/datatables/extensions/Responsive/dataTables.responsive.js +1232 -0
  40. data/app/assets/javascripts/datatables/extensions/Responsive/responsive.bootstrap.js +81 -0
  41. data/app/assets/javascripts/datatables/extensions/Responsive/responsive.bootstrap4.js +81 -0
  42. data/app/assets/javascripts/datatables/extensions/Responsive/responsive.foundation.js +62 -0
  43. data/app/assets/javascripts/datatables/extensions/Responsive/responsive.jqueryui.js +63 -0
  44. data/app/assets/javascripts/datatables/extensions/Responsive/responsive.semanticui.js +77 -0
  45. data/app/assets/javascripts/datatables/extensions/RowReorder/dataTables.rowReorder.js +709 -0
  46. data/app/assets/javascripts/datatables/extensions/Scroller/dataTables.scroller.js +1349 -0
  47. data/app/assets/javascripts/datatables/extensions/Select/dataTables.select.js +1109 -0
  48. data/app/assets/javascripts/datatables/jquery.dataTables.js +15278 -0
  49. data/app/assets/media/swf/flashExport.swf +0 -0
  50. data/app/assets/stylesheets/datatables/dataTables.bootstrap.css +185 -0
  51. data/app/assets/stylesheets/datatables/dataTables.bootstrap4.css +193 -0
  52. data/app/assets/stylesheets/datatables/dataTables.foundation.css +116 -0
  53. data/app/assets/stylesheets/datatables/dataTables.jqueryui.css +481 -0
  54. data/app/assets/stylesheets/datatables/dataTables.material.css +87 -0
  55. data/app/assets/stylesheets/datatables/dataTables.semanticui.css +103 -0
  56. data/app/assets/stylesheets/datatables/dataTables.uikit.css +146 -0
  57. data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.bootstrap.css +81 -0
  58. data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.bootstrap4.css +81 -0
  59. data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.dataTables.css +92 -0
  60. data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.foundation.css +85 -0
  61. data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.jqueryui.css +85 -0
  62. data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.semanticui.css +81 -0
  63. data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.bootstrap.css +102 -0
  64. data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.bootstrap4.css +163 -0
  65. data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.dataTables.css +298 -0
  66. data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.foundation.css +129 -0
  67. data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.jqueryui.css +162 -0
  68. data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.semanticui.css +114 -0
  69. data/app/assets/stylesheets/datatables/extensions/Buttons/common.scss +27 -0
  70. data/app/assets/stylesheets/datatables/extensions/Buttons/mixins.scss +89 -0
  71. data/app/assets/stylesheets/datatables/extensions/ColReorder/colReorder.bootstrap.css +11 -0
  72. data/app/assets/stylesheets/datatables/extensions/ColReorder/colReorder.bootstrap4.css +11 -0
  73. data/app/assets/stylesheets/datatables/extensions/ColReorder/colReorder.dataTables.css +11 -0
  74. data/app/assets/stylesheets/datatables/extensions/ColReorder/colReorder.foundation.css +11 -0
  75. data/app/assets/stylesheets/datatables/extensions/ColReorder/colReorder.jqueryui.css +11 -0
  76. data/app/assets/stylesheets/datatables/extensions/ColReorder/colReorder.semanticui.css +11 -0
  77. data/app/assets/stylesheets/datatables/extensions/FixedColumns/fixedColumns.bootstrap.css +44 -0
  78. data/app/assets/stylesheets/datatables/extensions/FixedColumns/fixedColumns.bootstrap4.css +44 -0
  79. data/app/assets/stylesheets/datatables/extensions/FixedColumns/fixedColumns.dataTables.css +18 -0
  80. data/app/assets/stylesheets/datatables/extensions/FixedColumns/fixedColumns.foundation.css +27 -0
  81. data/app/assets/stylesheets/datatables/extensions/FixedColumns/fixedColumns.jqueryui.css +8 -0
  82. data/app/assets/stylesheets/datatables/extensions/FixedColumns/fixedColumns.semanticui.css +16 -0
  83. data/app/assets/stylesheets/datatables/extensions/FixedHeader/fixedHeader.bootstrap.css +20 -0
  84. data/app/assets/stylesheets/datatables/extensions/FixedHeader/fixedHeader.bootstrap4.css +20 -0
  85. data/app/assets/stylesheets/datatables/extensions/FixedHeader/fixedHeader.dataTables.css +19 -0
  86. data/app/assets/stylesheets/datatables/extensions/FixedHeader/fixedHeader.foundation.css +20 -0
  87. data/app/assets/stylesheets/datatables/extensions/FixedHeader/fixedHeader.jqueryui.css +15 -0
  88. data/app/assets/stylesheets/datatables/extensions/FixedHeader/fixedHeader.semanticui.css +14 -0
  89. data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.bootstrap.css +5 -0
  90. data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.bootstrap4.css +5 -0
  91. data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.dataTables.css +5 -0
  92. data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.foundation.css +5 -0
  93. data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.jqueryui.css +5 -0
  94. data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.semanticui.css +5 -0
  95. data/app/assets/stylesheets/datatables/extensions/Responsive/responsive.bootstrap.css +181 -0
  96. data/app/assets/stylesheets/datatables/extensions/Responsive/responsive.bootstrap4.css +181 -0
  97. data/app/assets/stylesheets/datatables/extensions/Responsive/responsive.dataTables.css +178 -0
  98. data/app/assets/stylesheets/datatables/extensions/Responsive/responsive.foundation.css +181 -0
  99. data/app/assets/stylesheets/datatables/extensions/Responsive/responsive.jqueryui.css +178 -0
  100. data/app/assets/stylesheets/datatables/extensions/Responsive/responsive.semanticui.css +181 -0
  101. data/app/assets/stylesheets/datatables/extensions/RowReorder/rowReorder.bootstrap.css +22 -0
  102. data/app/assets/stylesheets/datatables/extensions/RowReorder/rowReorder.bootstrap4.css +22 -0
  103. data/app/assets/stylesheets/datatables/extensions/RowReorder/rowReorder.dataTables.css +22 -0
  104. data/app/assets/stylesheets/datatables/extensions/RowReorder/rowReorder.foundation.css +22 -0
  105. data/app/assets/stylesheets/datatables/extensions/RowReorder/rowReorder.jqueryui.css +22 -0
  106. data/app/assets/stylesheets/datatables/extensions/RowReorder/rowReorder.semanticui.css +22 -0
  107. data/app/assets/stylesheets/datatables/extensions/RowReorder/semanticui.scss +5 -0
  108. data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.bootstrap.css +24 -0
  109. data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.bootstrap4.css +24 -0
  110. data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.dataTables.css +20 -0
  111. data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.foundation.css +17 -0
  112. data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.jqueryui.css +20 -0
  113. data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.semanticui.css +20 -0
  114. data/app/assets/stylesheets/datatables/extensions/Select/select.bootstrap.css +110 -0
  115. data/app/assets/stylesheets/datatables/extensions/Select/select.bootstrap4.css +110 -0
  116. data/app/assets/stylesheets/datatables/extensions/Select/select.dataTables.css +100 -0
  117. data/app/assets/stylesheets/datatables/extensions/Select/select.foundation.css +112 -0
  118. data/app/assets/stylesheets/datatables/extensions/Select/select.jqueryui.css +100 -0
  119. data/app/assets/stylesheets/datatables/extensions/Select/select.semanticui.css +105 -0
  120. data/app/assets/stylesheets/datatables/jquery.dataTables.css +452 -0
  121. data/app/assets/stylesheets/datatables/jquery.dataTables_themeroller.css +416 -0
  122. data/jquery-datatables.gemspec +27 -0
  123. data/lib/generators/jquery/datatables/install_generator.rb +63 -0
  124. data/lib/generators/jquery/datatables/templates/bootstrap.css.tt +15 -0
  125. data/lib/generators/jquery/datatables/templates/bootstrap.js.tt +22 -0
  126. data/lib/generators/jquery/datatables/templates/bootstrap4.css.tt +15 -0
  127. data/lib/generators/jquery/datatables/templates/bootstrap4.js.tt +22 -0
  128. data/lib/generators/jquery/datatables/templates/foundation.css.tt +15 -0
  129. data/lib/generators/jquery/datatables/templates/foundation.js.tt +24 -0
  130. data/lib/generators/jquery/datatables/templates/jqueryui.css.tt +15 -0
  131. data/lib/generators/jquery/datatables/templates/jqueryui.js.tt +18 -0
  132. data/lib/generators/jquery/datatables/templates/material.css.tt +15 -0
  133. data/lib/generators/jquery/datatables/templates/material.js.tt +19 -0
  134. data/lib/generators/jquery/datatables/templates/regular.css.tt +15 -0
  135. data/lib/generators/jquery/datatables/templates/regular.js.tt +18 -0
  136. data/lib/generators/jquery/datatables/templates/semanticui.css.tt +16 -0
  137. data/lib/generators/jquery/datatables/templates/semanticui.js.tt +22 -0
  138. data/lib/generators/jquery/datatables/templates/uikit.css.tt +15 -0
  139. data/lib/generators/jquery/datatables/templates/uikit.js.tt +19 -0
  140. data/lib/jquery-datatables.rb +26 -0
  141. data/lib/jquery-datatables/engine.rb +11 -0
  142. data/lib/jquery-datatables/version.rb +6 -0
  143. metadata +269 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1951c5edc47ddce61d83357828033e75e7b35229
4
+ data.tar.gz: a0f86f4402eafb18d4edf8e3f45b96fccc1a905a
5
+ SHA512:
6
+ metadata.gz: 5d767632d30f637ef0ed41a9248220d3491ba1da4f7330122a0505644b75006248367cc231ee09494eddc58191b530a42d43a6f303eb2089158141e12675df01
7
+ data.tar.gz: d6115130d079c5085920b01452ded32c61b58d707d9a9057336606fcb128f70b71865368c6f780ff27db0f934d0d042f06107f0d3e7b122d60ce2f73d70f9556
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+ DataTablesSrc/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in datatables-rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,27 @@
1
+ app/assets/**/*:
2
+ Copyright (c) 2008-2015 SpryMedia Limited
3
+ http://datatables.net
4
+
5
+ Other files:
6
+ Copyright (c) 2016 Mohd Khairi
7
+
8
+ MIT License
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining
11
+ a copy of this software and associated documentation files (the
12
+ "Software"), to deal in the Software without restriction, including
13
+ without limitation the rights to use, copy, modify, merge, publish,
14
+ distribute, sublicense, and/or sell copies of the Software, and to
15
+ permit persons to whom the Software is furnished to do so, subject to
16
+ the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be
19
+ included in all copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,118 @@
1
+ # jquery-datatables [![Gem Version](https://badge.fury.io/rb/jquery-datatables.svg)](http://badge.fury.io/rb/jquery-datatables)
2
+ Jquery datatables assets pipeline :: sprockets
3
+
4
+ Include [jQuery DataTables](http://www.datatables.net/) in your asset pipeline with ease using [jqury-datatables](https://rubygems.org/gems/jqury-datatables) gem.
5
+
6
+ ## Gem Installation
7
+
8
+ ### Requirements
9
+ To use this gem you need to include [jQuery](http://jquery.com/) in your applications's javascript.
10
+ To do so you may use the [jquery-rails gem](https://github.com/rails/jquery-rails). By default rails already include it.
11
+
12
+
13
+ Add this line to your application's `Gemfile`:
14
+
15
+ ```
16
+ gem 'jquery-datatables'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle install
22
+
23
+ ## Install generator
24
+
25
+ ### command
26
+ ```
27
+ rails g jquery:datatables:install
28
+
29
+ ```
30
+
31
+ or if you using bootstrap
32
+
33
+ ```
34
+ rails g jquery:datatables:install bootstrap
35
+
36
+ ```
37
+
38
+ this generator will:
39
+ - 1. append ```//= require datatables ``` add `app/assets/javascripts/application.js`
40
+ - 2. append ```*= require datatables ``` add `app/assets/stylesheets/application.css`
41
+ - 3. create datatable.js in ```app/assets/javasrcipts/```
42
+ - 4. create datatable.css in ```app/assets/stylesheets/```
43
+
44
+ ## Manual install
45
+
46
+ ### JavaScripts
47
+
48
+ Include the JavaScript in your `app/assets/javascripts/application.js`:
49
+ ```
50
+ //= require jquery
51
+ //= require datatables
52
+
53
+ ```
54
+ create new file `app/assets/javascripts/datatables.js`
55
+ ```
56
+ //Core component
57
+ //= require datatables/jquery.dataTables
58
+ //Bootstrap4 theme
59
+ //= require datatables/dataTables.bootstrap4
60
+
61
+ //Optional Datatables extensions
62
+ //= require datatables/extensions/Responsive/dataTables.responsive
63
+ //= require datatables/extensions/Responsive/responsive.bootstrap4
64
+ //= require datatables/extensions/Buttons/dataTables.buttons
65
+ //= require datatables/extensions/Buttons/buttons.html5
66
+ //= require datatables/extensions/Buttons/buttons.print
67
+ //= require datatables/extensions/Buttons/buttons.bootstrap4
68
+
69
+ ```
70
+ *** you may refer other extensions in this directory: [click me](https://github.com/mkhairi/jquery-datatables/tree/master/app/assets/javascripts/datatables/extensions)
71
+
72
+ ### Stylesheets
73
+ Include the stylesheet in your `app/assets/stylesheets/application.css`:
74
+ ```
75
+ *= require datatables
76
+ ```
77
+
78
+ create new file `app/assets/stylesheets/datatables.css`
79
+ <br>
80
+ ** default theme
81
+ ```
82
+ /*
83
+ *= require datatables/jquery.dataTables
84
+ *= require datatables/extensions/Responsive/responsive.datatables
85
+ *= require datatables/extensions/Buttons/buttons.dataTables
86
+ */
87
+ ```
88
+ ** if using boostrap theme
89
+ ```
90
+ /*
91
+ *= require datatables/dataTables.bootstrap4
92
+ *= require datatables/extensions/Responsive/responsive.bootstrap4
93
+ *= require datatables/extensions/Buttons/buttons.bootstrap4
94
+ */
95
+
96
+ ```
97
+ *** you may refer other extensions in this directory: [click me](https://github.com/mkhairi/jquery-datatables/tree/master/app/assets/stylesheets/datatables/extensions)
98
+
99
+ ### Initialization
100
+
101
+ Where needed in your JavaScripts, initialize your DataTables:
102
+
103
+ ```
104
+ $(document).ready(function() {
105
+ $("#dttb").dataTable();
106
+ });
107
+ ```
108
+
109
+ ## Todo
110
+ - add plugins
111
+ - update instructions
112
+
113
+ ## Contributing
114
+
115
+ 1. [Fork it]( https://github.com/mkhairi/jquery-datatables/fork)
116
+ 2. Commit your changes (`git commit -am 'My Changes'`)
117
+ 3. Push your changes (`git push origin`)
118
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,166 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ datatables_dir = "DataTablesSrc"
4
+ extensions = %w(AutoFill Buttons ColReorder FixedColumns FixedHeader KeyTable Responsive RowReorder Scroller Select)
5
+ frameworks = %w(regular bootstrap bootstrap4 foundation jqueryui material semanticui uikit)
6
+
7
+ namespace :images do
8
+
9
+ desc "Delete images directory"
10
+ task :clean do
11
+ tgt_dir = "app/assets/media/datatables/"
12
+ rm_rf tgt_dir
13
+ end
14
+
15
+ desc "Copy images from #{datatables_dir}/media/images/"
16
+ task :copy do
17
+ tgt_dir = "app/assets/images/datatables/"
18
+ mkdir_p tgt_dir
19
+ Dir.glob("#{datatables_dir}/media/images/*.png") do |src_file|
20
+ cp src_file, tgt_dir
21
+ end
22
+ end
23
+
24
+ desc "Setup image assets"
25
+ task setup: [:clean, :copy]
26
+ end
27
+
28
+ namespace :javascripts do
29
+
30
+ desc "Cleaning javascripts directory"
31
+ task :clean do
32
+ rm_rf "app/assets/javascripts/datatables"
33
+ end
34
+
35
+ desc "Copy #{datatables_dir}/media/js/"
36
+ task :copy do
37
+ src_dir = "#{datatables_dir}/media/js/."
38
+ tgt_dir = "app/assets/javascripts/datatables/"
39
+ mkdir_p tgt_dir
40
+ cp_r src_dir, tgt_dir
41
+ end
42
+
43
+ desc "Copy #{datatables_dir}/extensions/*/js"
44
+ task :copy_extensions do
45
+ extensions.each do |ext|
46
+ src_dir = "#{datatables_dir}/extensions/#{ext}/js/."
47
+ tgt_dir = "app/assets/javascripts/datatables/extensions/#{ext}/"
48
+ mkdir_p tgt_dir
49
+ cp_r src_dir, tgt_dir
50
+ end
51
+ end
52
+
53
+ desc "Setup javascript assets"
54
+ task setup: [:clean, :copy, :copy_extensions]
55
+ end
56
+
57
+ namespace :stylesheets do
58
+ desc "Cleaning stylesheets directory"
59
+ task :clean do
60
+ rm_rf "app/assets/stylesheets/datatables"
61
+ end
62
+
63
+ desc "Copy #{datatables_dir}/media/css/"
64
+ task :copy do
65
+ src_dir = "#{datatables_dir}/media/css/."
66
+ tgt_dir = "app/assets/stylesheets/datatables/"
67
+ mkdir_p tgt_dir
68
+ cp_r src_dir, tgt_dir
69
+ end
70
+
71
+ desc "Copy #{datatables_dir}/extensions/*/css"
72
+ task :copy_extensions do
73
+ extensions.each do |ext|
74
+ src_dir = "#{datatables_dir}/extensions/#{ext}/css/."
75
+ tgt_dir = "app/assets/stylesheets/datatables/extensions/#{ext}/"
76
+ mkdir_p tgt_dir
77
+ cp_r src_dir, tgt_dir
78
+ end
79
+ end
80
+
81
+ desc "Fix image URLs in stylesheets"
82
+ task :fix_urls do
83
+ Dir.glob('app/assets/stylesheet/datatables/*.css').each do |tgt_file|
84
+ content = File.read(tgt_file)
85
+ fixed_content = content.gsub(/url\(\"\.\.\/images\/([A-Za-z_]*.png)\"\)/, 'image-url("\1")')
86
+ File.open(tgt_file, "w") { |f| f.puts fixed_content}
87
+ end
88
+ end
89
+
90
+ desc "Setup stylesheet assets"
91
+ task setup: [:clean, :copy, :copy_extensions, :fix_urls]
92
+ end
93
+
94
+ desc "Remove minified file .min"
95
+ task :cleanup do
96
+ Dir.glob('app/assets/**/*.min.*').each do |file|
97
+ rm file
98
+ end
99
+ rm "app/assets/javascripts/datatables/jquery.js"
100
+ end
101
+
102
+ task :templates do
103
+ templates_dir = "lib/generators/jquery/datatables/templates"
104
+ rm_rf templates_dir
105
+ mkdir_p templates_dir
106
+ stylesheets = Dir.glob('app/assets/stylesheets/**/*')
107
+ javascripts = Dir.glob('app/assets/javascripts/**/*')
108
+
109
+ frameworks.each do |framework|
110
+ tgt_css_file = "#{templates_dir}/#{framework}.css.tt"
111
+ tgt_js_file = "#{templates_dir}/#{framework}.js.tt"
112
+
113
+
114
+ javascripts.each do |file|
115
+ file_name = file.gsub("app/assets/javascripts/", "")
116
+ File.open(tgt_js_file, "a") { |f| f.puts "//=require #{file_name}"} if file_name.match(/jquery\./)
117
+ end
118
+
119
+ javascripts.each do |file|
120
+ file_name = file.gsub("app/assets/javascripts/", "")
121
+ next if frameworks.any? { |s| file_name.match(/#{Regexp.escape(s)}/) } or file_name.match(/jquery/)
122
+ File.open(tgt_js_file, "a") { |f| f.puts "// require #{file_name}"} if file_name.match(/dataTables/)
123
+ end
124
+
125
+
126
+ case framework
127
+
128
+ when "bootstrap", "bootstrap4", "foundation", "jqueryui", "material", "semanticui", "uikit"
129
+
130
+ stylesheets.each do |file|
131
+ file_name = file.gsub("app/assets/stylesheets/", "")
132
+ File.open(tgt_css_file, "a") { |f| f.puts "*= #{file_name}"} if file_name.match(/#{Regexp.escape(framework)}\./)
133
+ end
134
+
135
+ javascripts.each do |file|
136
+ file_name = file.gsub("app/assets/javascripts/", "")
137
+ File.open(tgt_js_file, "a") { |f| f.puts "//=require #{file_name}"} if file_name.match(/#{Regexp.escape(framework)}\./)
138
+ end
139
+
140
+ else
141
+
142
+ #core first]
143
+ stylesheets.each do |file|
144
+ file_name = file.gsub("app/assets/stylesheets/", "")
145
+ File.open(tgt_css_file, "a") { |f| f.puts "*=require #{file_name}"} if file_name.match(/jquery\./)
146
+ end
147
+
148
+ #plugins
149
+ stylesheets.each do |file|
150
+ file_name = file.gsub("app/assets/stylesheets/", "")
151
+ next if frameworks.any? { |s| file_name.match(/#{Regexp.escape(s)}/) } or file_name.match(/jquery/)
152
+ File.open(tgt_css_file, "a") { |f| f.puts "*=require '#{file_name}';"} if file_name.match(/dataTables/)
153
+ end
154
+
155
+
156
+
157
+ end
158
+
159
+ end
160
+
161
+
162
+
163
+ end
164
+
165
+ desc "Setup or update assets files"
166
+ task setup: ["images:setup", "javascripts:setup", "stylesheets:setup"]
@@ -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 = '&#x2026;';
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
+ }));