jquery-datatables 1.10.16 → 1.10.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +2 -0
  3. data/app/assets/javascripts/datatables/dataTables.foundation.js +2 -2
  4. data/app/assets/javascripts/datatables/dataTables.uikit.js +1 -1
  5. data/app/assets/javascripts/datatables/extensions/AutoFill/autoFill.dataTables.js +38 -0
  6. data/app/assets/javascripts/datatables/extensions/AutoFill/dataTables.autoFill.js +52 -12
  7. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.colVis.js +4 -8
  8. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.dataTables.js +38 -0
  9. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.flash.js +17 -7
  10. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.html5.js +33 -19
  11. data/app/assets/javascripts/datatables/extensions/Buttons/buttons.print.js +14 -3
  12. data/app/assets/javascripts/datatables/extensions/Buttons/dataTables.buttons.js +120 -53
  13. data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.bootstrap.js +38 -0
  14. data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.bootstrap4.js +38 -0
  15. data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.dataTables.js +38 -0
  16. data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.foundation.js +38 -0
  17. data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.jqueryui.js +38 -0
  18. data/app/assets/javascripts/datatables/extensions/ColReorder/colReorder.semanicui.js +38 -0
  19. data/app/assets/javascripts/datatables/extensions/ColReorder/dataTables.colReorder.js +76 -13
  20. data/app/assets/javascripts/datatables/extensions/FixedColumns/dataTables.fixedColumns.js +23 -17
  21. data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.bootstrap.js +38 -0
  22. data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.bootstrap4.js +38 -0
  23. data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.dataTables.js +38 -0
  24. data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.foundation.js +38 -0
  25. data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.jqueryui.js +38 -0
  26. data/app/assets/javascripts/datatables/extensions/FixedColumns/fixedColumns.semanicui.js +38 -0
  27. data/app/assets/javascripts/datatables/extensions/FixedHeader/dataTables.fixedHeader.js +26 -11
  28. data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.bootstrap.js +38 -0
  29. data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.bootstrap4.js +38 -0
  30. data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.dataTables.js +38 -0
  31. data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.foundation.js +38 -0
  32. data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.jqueryui.js +38 -0
  33. data/app/assets/javascripts/datatables/extensions/FixedHeader/fixedHeader.semanicui.js +38 -0
  34. data/app/assets/javascripts/datatables/extensions/KeyTable/dataTables.keyTable.js +141 -75
  35. data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.bootstrap.js +38 -0
  36. data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.bootstrap4.js +38 -0
  37. data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.dataTables.js +38 -0
  38. data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.foundation.js +38 -0
  39. data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.jqueryui.js +38 -0
  40. data/app/assets/javascripts/datatables/extensions/KeyTable/keyTable.semanicui.js +38 -0
  41. data/app/assets/javascripts/datatables/extensions/Responsive/dataTables.responsive.js +64 -26
  42. data/app/assets/javascripts/datatables/extensions/Responsive/responsive.dataTables.js +38 -0
  43. data/app/assets/javascripts/datatables/extensions/RowGroup/dataTables.rowGroup.js +45 -13
  44. data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.bootstrap.js +38 -0
  45. data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.bootstrap4.js +38 -0
  46. data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.dataTables.js +38 -0
  47. data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.foundation.js +38 -0
  48. data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.jqueryui.js +38 -0
  49. data/app/assets/javascripts/datatables/extensions/RowGroup/rowGroup.semanicui.js +38 -0
  50. data/app/assets/javascripts/datatables/extensions/RowReorder/dataTables.rowReorder.js +24 -6
  51. data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.bootstrap.js +38 -0
  52. data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.bootstrap4.js +38 -0
  53. data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.dataTables.js +38 -0
  54. data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.foundation.js +38 -0
  55. data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.jqueryui.js +38 -0
  56. data/app/assets/javascripts/datatables/extensions/RowReorder/rowReorder.semanicui.js +38 -0
  57. data/app/assets/javascripts/datatables/extensions/Scroller/dataTables.scroller.js +93 -87
  58. data/app/assets/javascripts/datatables/extensions/Scroller/scroller.bootstrap.js +38 -0
  59. data/app/assets/javascripts/datatables/extensions/Scroller/scroller.bootstrap4.js +38 -0
  60. data/app/assets/javascripts/datatables/extensions/Scroller/scroller.dataTables.js +38 -0
  61. data/app/assets/javascripts/datatables/extensions/Scroller/scroller.foundation.js +38 -0
  62. data/app/assets/javascripts/datatables/extensions/Scroller/scroller.jqueryui.js +38 -0
  63. data/app/assets/javascripts/datatables/extensions/Scroller/scroller.semanticui.js +38 -0
  64. data/app/assets/javascripts/datatables/extensions/Select/dataTables.select.js +41 -14
  65. data/app/assets/javascripts/datatables/extensions/Select/select.bootstrap.js +38 -0
  66. data/app/assets/javascripts/datatables/extensions/Select/select.bootstrap4.js +38 -0
  67. data/app/assets/javascripts/datatables/extensions/Select/select.dataTables.js +38 -0
  68. data/app/assets/javascripts/datatables/extensions/Select/select.foundation.js +38 -0
  69. data/app/assets/javascripts/datatables/extensions/Select/select.jqueryui.js +38 -0
  70. data/app/assets/javascripts/datatables/extensions/Select/select.semanticui.js +38 -0
  71. data/app/assets/javascripts/datatables/jquery.dataTables.js +125 -72
  72. data/app/assets/stylesheets/datatables/dataTables.bootstrap4.scss +4 -0
  73. data/app/assets/stylesheets/datatables/dataTables.foundation.scss +5 -5
  74. data/app/assets/stylesheets/datatables/dataTables.material.scss +1 -1
  75. data/app/assets/stylesheets/datatables/dataTables.uikit.scss +33 -22
  76. data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.bootstrap.scss +9 -0
  77. data/app/assets/stylesheets/datatables/extensions/AutoFill/autoFill.bootstrap4.scss +9 -0
  78. data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.dataTables.scss +3 -2
  79. data/app/assets/stylesheets/datatables/extensions/Buttons/buttons.jqueryui.scss +2 -4
  80. data/app/assets/stylesheets/datatables/extensions/Buttons/mixins.scss +5 -0
  81. data/app/assets/stylesheets/datatables/extensions/FixedColumns/fixedColumns.bootstrap4.scss +3 -6
  82. data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.bootstrap.scss +1 -1
  83. data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.bootstrap4.scss +1 -1
  84. data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.dataTables.scss +6 -5
  85. data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.foundation.scss +1 -1
  86. data/app/assets/stylesheets/datatables/extensions/KeyTable/keyTable.semanticui.scss +1 -1
  87. data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.bootstrap.scss +1 -1
  88. data/app/assets/stylesheets/datatables/extensions/Scroller/scroller.bootstrap4.scss +2 -4
  89. data/app/assets/stylesheets/datatables/jquery.dataTables.scss +5 -5
  90. data/jquery-datatables.gemspec +4 -2
  91. data/lib/generators/jquery/datatables/install_generator.rb +22 -6
  92. data/lib/generators/jquery/datatables/templates/{bootstrap.js.tt → javascripts/bootstrap.js.tt} +0 -0
  93. data/lib/generators/jquery/datatables/templates/{bootstrap4.js.tt → javascripts/bootstrap4.js.tt} +0 -0
  94. data/lib/generators/jquery/datatables/templates/{foundation.js.tt → javascripts/foundation.js.tt} +0 -0
  95. data/lib/generators/jquery/datatables/templates/javascripts/initializer.js.tt +30 -0
  96. data/lib/generators/jquery/datatables/templates/{jqueryui.js.tt → javascripts/jqueryui.js.tt} +0 -0
  97. data/lib/generators/jquery/datatables/templates/{material.js.tt → javascripts/material.js.tt} +0 -0
  98. data/lib/generators/jquery/datatables/templates/{regular.js.tt → javascripts/regular.js.tt} +0 -0
  99. data/lib/generators/jquery/datatables/templates/{semanticui.js.tt → javascripts/semanticui.js.tt} +0 -0
  100. data/lib/generators/jquery/datatables/templates/{uikit.js.tt → javascripts/uikit.js.tt} +0 -0
  101. data/lib/generators/jquery/datatables/templates/{bootstrap.scss.tt → stylesheets/bootstrap.scss.tt} +0 -0
  102. data/lib/generators/jquery/datatables/templates/{bootstrap4.scss.tt → stylesheets/bootstrap4.scss.tt} +0 -0
  103. data/lib/generators/jquery/datatables/templates/{foundation.scss.tt → stylesheets/foundation.scss.tt} +0 -0
  104. data/lib/generators/jquery/datatables/templates/{jqueryui.scss.tt → stylesheets/jqueryui.scss.tt} +0 -0
  105. data/lib/generators/jquery/datatables/templates/{material.scss.tt → stylesheets/material.scss.tt} +0 -0
  106. data/lib/generators/jquery/datatables/templates/{regular.scss.tt → stylesheets/regular.scss.tt} +0 -0
  107. data/lib/generators/jquery/datatables/templates/{semanticui.scss.tt → stylesheets/semanticui.scss.tt} +0 -0
  108. data/lib/generators/jquery/datatables/templates/{uikit.scss.tt → stylesheets/uikit.scss.tt} +0 -0
  109. data/lib/generators/jquery/datatables/templates/views/index.html.erb +17 -0
  110. data/lib/generators/jquery/datatables/templates/views/index.html.slim +12 -0
  111. data/lib/generators/jquery/datatables/templates/views/index.json.jbuilder +10 -0
  112. data/lib/jquery-datatables.rb +53 -5
  113. data/lib/jquery-datatables/engine.rb +2 -0
  114. data/lib/jquery-datatables/version.rb +1 -1
  115. metadata +86 -31
@@ -111,19 +111,19 @@ table.dataTable thead {
111
111
  }
112
112
 
113
113
  .sorting {
114
- background-image: image-url("datatables/sort_both.png");
114
+ background-image: url('../images/sort_both.png');
115
115
  }
116
116
  .sorting_asc {
117
- background-image: image-url("datatables/sort_asc.png");
117
+ background-image: url('../images/sort_asc.png');
118
118
  }
119
119
  .sorting_desc {
120
- background-image: image-url("datatables/sort_desc.png");
120
+ background-image: url('../images/sort_desc.png');
121
121
  }
122
122
  .sorting_asc_disabled {
123
- background-image: image-url("datatables/sort_asc_disabled.png");
123
+ background-image: url('../images/sort_asc_disabled.png');
124
124
  }
125
125
  .sorting_desc_disabled {
126
- background-image: image-url("datatables/sort_desc_disabled.png");
126
+ background-image: url('../images/sort_desc_disabled.png');
127
127
  }
128
128
  }
129
129
 
@@ -98,4 +98,4 @@ table.dataTable thead {
98
98
  .sorting_desc_disabled:after {
99
99
  opacity: 0;
100
100
  }
101
- }
101
+ }
@@ -1,9 +1,6 @@
1
1
 
2
2
  table.dataTable {
3
3
  clear: both;
4
- margin-top: 6px !important;
5
- margin-bottom: 6px !important;
6
- max-width: none !important;
7
4
 
8
5
  td,
9
6
  th {
@@ -90,42 +87,56 @@ div.dataTables_wrapper {
90
87
  }
91
88
 
92
89
 
93
- // Sorting icons using UIKit's built in icons (Font Awesome)
90
+ // Sorting - using :before and :after with UTF8 characters
94
91
  table.dataTable thead {
95
92
  > tr > th,
96
93
  > tr > td {
97
- position: relative;
98
-
99
94
  &.sorting_asc,
100
95
  &.sorting_desc,
101
96
  &.sorting {
102
97
  padding-right: 30px;
103
98
  }
104
99
 
105
- &.sorting:after,
106
- &.sorting_asc:after,
107
- &.sorting_desc:after {
100
+ &:active {
101
+ outline: none;
102
+ }
103
+ }
104
+
105
+ .sorting,
106
+ .sorting_asc,
107
+ .sorting_desc,
108
+ .sorting_asc_disabled,
109
+ .sorting_desc_disabled {
110
+ cursor: pointer;
111
+ position: relative;
112
+
113
+ &:before,
114
+ &:after {
108
115
  position: absolute;
109
- top: 7px;
110
- right: 8px;
116
+ bottom: 1.2em;
111
117
  display: block;
112
- font-family: 'FontAwesome';
118
+ opacity: 0.3;
113
119
  }
114
120
 
115
- &.sorting:after {
116
- content: "\f0dc";
117
- color: #ddd;
118
- font-size: 0.8em;
119
- padding-top: 0.12em;
121
+ &:before {
122
+ right: 1em;
123
+ content: "\2191"; // up arrow - ascending
120
124
  }
121
125
 
122
- &.sorting_asc:after {
123
- content: "\f0de";
126
+ &:after {
127
+ right: 0.5em;
128
+ content: "\2193"; // down arrow - descending
124
129
  }
130
+ }
125
131
 
126
- &.sorting_desc:after {
127
- content: "\f0dd";
128
- }
132
+ .sorting_asc:before,
133
+ .sorting_desc:after {
134
+ opacity: 1;
135
+ }
136
+
137
+ .sorting_asc_disabled:before,
138
+ .sorting_desc_disabled:after {
139
+ opacity: 0;
129
140
  }
130
141
  }
131
142
 
@@ -6,3 +6,12 @@ $autofill-handle-background: #337ab7;
6
6
 
7
7
  @import 'autoFill.dataTables.scss';
8
8
 
9
+ div.dt-autofill-list {
10
+ div.dt-autofill-question {
11
+ input[type=number] {
12
+ padding: 6px;
13
+ width: 60px;
14
+ margin: -2px 0;
15
+ }
16
+ }
17
+ }
@@ -6,3 +6,12 @@ $autofill-handle-background: #0275d8;
6
6
 
7
7
  @import 'autoFill.dataTables.scss';
8
8
 
9
+ div.dt-autofill-list {
10
+ div.dt-autofill-question {
11
+ input[type=number] {
12
+ padding: 6px;
13
+ width: 60px;
14
+ margin: -2px 0;
15
+ }
16
+ }
17
+ }
@@ -9,11 +9,13 @@ a.dt-button {
9
9
  display: inline-block;
10
10
  box-sizing: border-box;
11
11
  margin-right: 0.333em;
12
+ margin-bottom: 0.333em;
12
13
  padding: 0.5em 1em;
13
14
  border: 1px solid #999;
14
15
  border-radius: 2px;
15
16
  cursor: pointer;
16
17
  font-size: 0.88em;
18
+ line-height: 1.6em;
17
19
  color: black;
18
20
  //box-shadow: 1px 1px 3px #ccc;
19
21
  white-space: nowrap;
@@ -91,14 +93,13 @@ div.dt-button-collection {
91
93
  border-radius: 5px;
92
94
  box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
93
95
 
94
- z-index: 2002;
95
-
96
96
  button.dt-button,
97
97
  div.dt-button,
98
98
  a.dt-button {
99
99
  position: relative;
100
100
  left: 0;
101
101
  right: 0;
102
+ width: 100%;
102
103
 
103
104
  display: block;
104
105
  float: none;
@@ -48,14 +48,12 @@ div.dt-button-collection {
48
48
  position: relative;
49
49
  left: 0;
50
50
  right: 0;
51
+ width: 100%;
51
52
 
52
53
  display: block;
53
54
  float: none;
54
55
  margin-right: 0;
55
-
56
- &:last-child {
57
- margin-bottom: 4px;
58
- }
56
+ margin-bottom: 4px;
59
57
 
60
58
  &:hover > span {
61
59
  background-color: rgba(0, 0, 0, 0.05);
@@ -86,6 +86,11 @@
86
86
  -o-column-count: 4;
87
87
  column-count: 4;
88
88
  }
89
+
90
+ // Chrome fix - 531528
91
+ .dt-button {
92
+ border-radius: 0;
93
+ }
89
94
  }
90
95
 
91
96
 
@@ -1,11 +1,8 @@
1
1
 
2
2
  @import 'fixedColumns.bootstrap.scss';
3
3
 
4
- // Bootstrap 4 uses rgba for the table background colours, so we need to
5
- // block them out
6
- table.dataTable.table-striped.DTFC_Cloned tbody tr:nth-of-type(odd) {
7
- background-color: #F3F3F3;
8
- }
9
- table.dataTable.table-striped.DTFC_Cloned tbody tr:nth-of-type(even) {
4
+ // Bootstrap 4 uses rgba for the table row background colours, and as FixedColumns
5
+ // layers the elements on top of each other, we need to block out the fixed area.
6
+ table.dataTable.table-striped.DTFC_Cloned tbody {
10
7
  background-color: white;
11
8
  }
@@ -1,4 +1,4 @@
1
1
 
2
- $keytable-focus: 3px solid #337ab7 !default;
2
+ $keytable-focus: #337ab7 !default;
3
3
 
4
4
  @import 'keyTable.dataTables.scss';
@@ -1,4 +1,4 @@
1
1
 
2
- $keytable-focus: 3px solid #0275d8 !default;
2
+ $keytable-focus: #0275d8 !default;
3
3
 
4
4
  @import 'keyTable.dataTables.scss';
@@ -1,10 +1,11 @@
1
1
 
2
- $keytable-focus: 3px solid #3366FF !default;
2
+ $keytable-focus: #3366FF !default;
3
3
 
4
4
  table.dataTable {
5
- th.focus,
6
- td.focus {
7
- outline: $keytable-focus;
8
- outline-offset: -1px;
5
+ tbody {
6
+ th.focus,
7
+ td.focus {
8
+ box-shadow: inset 0 0 1px 2px $keytable-focus;
9
+ }
9
10
  }
10
11
  }
@@ -1,4 +1,4 @@
1
1
 
2
- $keytable-focus: 3px solid #008CBA !default;
2
+ $keytable-focus: #008CBA !default;
3
3
 
4
4
  @import 'keyTable.dataTables.scss';
@@ -1,4 +1,4 @@
1
1
 
2
- $keytable-focus: 3px solid #888 !default;
2
+ $keytable-focus: #888 !default;
3
3
 
4
4
  @import 'keyTable.dataTables.scss';
@@ -3,7 +3,7 @@
3
3
 
4
4
  div.DTS {
5
5
  // Don't have transparent rows
6
- tbody tr.even {
6
+ tbody tr {
7
7
  background-color: white;
8
8
  }
9
9
  }
@@ -1,9 +1,7 @@
1
1
 
2
2
  @import 'scroller.dataTables.scss';
3
3
 
4
- div.DTS {
4
+ div.DTS div.dataTables_scrollBody table {
5
5
  // Don't have transparent rows
6
- tbody tr.even {
7
- background-color: white;
8
- }
6
+ background-color: white;
9
7
  }
@@ -114,19 +114,19 @@ table.dataTable {
114
114
  }
115
115
 
116
116
  .sorting {
117
- background-image: image-url("datatables/sort_both.png");
117
+ background-image: url('../images/sort_both.png');
118
118
  }
119
119
  .sorting_asc {
120
- background-image: image-url("datatables/sort_asc.png");
120
+ background-image: url('../images/sort_asc.png');
121
121
  }
122
122
  .sorting_desc {
123
- background-image: image-url("datatables/sort_desc.png");
123
+ background-image: url('../images/sort_desc.png');
124
124
  }
125
125
  .sorting_asc_disabled {
126
- background-image: image-url("datatables/sort_asc_disabled.png");
126
+ background-image: url('../images/sort_asc_disabled.png');
127
127
  }
128
128
  .sorting_desc_disabled {
129
- background-image: image-url("datatables/sort_desc_disabled.png");
129
+ background-image: url('../images/sort_desc_disabled.png');
130
130
  }
131
131
  }
132
132
  }
@@ -18,8 +18,10 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency 'actionpack', '~> 4.1'
22
- spec.add_development_dependency 'activesupport', '~> 4.1'
21
+
22
+ spec.add_runtime_dependency 'sass', '>= 3.5.2'
23
+ spec.add_runtime_dependency 'autoprefixer-rails', '>= 6.0.3'
24
+
23
25
  spec.add_development_dependency 'sprockets-rails', '~> 2.3'
24
26
  spec.add_development_dependency 'jquery-rails', '~> 3.1'
25
27
  spec.add_development_dependency "bundler", "~> 1.7"
@@ -9,6 +9,7 @@ module Jquery
9
9
  argument :style, :type => :string, :default => 'regular'
10
10
  # needed for thor templates
11
11
  source_root File.expand_path("../templates", __FILE__)
12
+ class_option :template_engine, desc: 'Template engine to be invoked (erb, haml or slim).'
12
13
 
13
14
  def add_assets
14
15
  js_manifest = 'app/assets/javascripts/application.js'
@@ -16,17 +17,24 @@ module Jquery
16
17
  scss_manifest = 'app/assets/stylesheets/application.scss'
17
18
  js_strings = "//= require datatables\n"
18
19
 
19
- insert_into_file js_manifest, js_strings, :after => "jquery_ujs\n" if File.exists?(js_manifest)
20
+ insert_into_file js_manifest, js_strings, :after => "turbolinks\n" if File.exists?(js_manifest)
20
21
  insert_css_strings(css_manifest) if File.exists?(css_manifest)
21
22
  insert_scss_strings(scss_manifest) if File.exists?(scss_manifest)
22
- copy_core_file
23
+ copy_assets_file
24
+ append_global_initializer
25
+ end
26
+
27
+ def copy_scaffold_template
28
+ engine = options[:template_engine]
29
+ copy_file "views/index.html.#{engine}", "lib/templates/#{engine}/scaffold/index.html.#{engine}"
30
+ copy_file "views/index.json.jbuilder", "lib/templates//rails/jbuilder/index.json.jbuilder"
23
31
  end
24
32
 
25
33
  private
26
34
 
27
35
  def insert_css_strings(css_manifest)
28
36
  content = File.read(css_manifest)
29
- css_strings = "*/= require datatables\n"
37
+ css_strings = "*= require datatables\n"
30
38
 
31
39
  if requires_tree(content)
32
40
  insert_into_file css_manifest, css_strings, :after => "require_tree .\n"
@@ -44,6 +52,13 @@ module Jquery
44
52
  append_to_file scss_manifest, scss_strings
45
53
  end
46
54
 
55
+ def append_global_initializer
56
+ init = File.expand_path(find_in_source_paths("javascripts/initializer.js.tt"))
57
+ content = File.read(init)
58
+ js_datatables = "app/assets/javascripts/datatables.js"
59
+ append_to_file js_datatables, content
60
+ end
61
+
47
62
  def requires_tree(content)
48
63
  content.match(/require_tree\s+\.\s*$/)
49
64
  end
@@ -52,11 +67,12 @@ module Jquery
52
67
  content.match(/require_self\s*$/)
53
68
  end
54
69
 
55
- def copy_core_file
56
- template "#{style}.js.tt", "app/assets/javascripts/datatables.js"
57
- template "#{style}.scss.tt", "app/assets/stylesheets/datatables.scss"
70
+ def copy_assets_file
71
+ template "javascripts/#{style}.js.tt", "app/assets/javascripts/datatables.js"
72
+ template "stylesheets/#{style}.scss.tt", "app/assets/stylesheets/datatables.scss"
58
73
  end
59
74
 
75
+
60
76
  end
61
77
  end
62
78
  end
@@ -0,0 +1,30 @@
1
+
2
+
3
+ //Global setting and initializer
4
+
5
+ $.extend( $.fn.dataTable.defaults, {
6
+ responsive: true,
7
+ pagingType: 'full',
8
+ //dom:
9
+ // "<'row'<'col-sm-4 text-left'f><'right-action col-sm-8 text-right'<'buttons'B> <'select-info'> >>" +
10
+ // "<'row'<'dttb col-12 px-0'tr>>" +
11
+ // "<'row'<'col-sm-12 table-footer'lip>>"
12
+ });
13
+
14
+
15
+ $(document).on('preInit.dt', function(e, settings) {
16
+ var api, table_id, url;
17
+ api = new $.fn.dataTable.Api(settings);
18
+ table_id = "#" + api.table().node().id;
19
+ url = $(table_id).data('source');
20
+ if (url) {
21
+ return api.ajax.url(url);
22
+ }
23
+ });
24
+
25
+
26
+ $(document).on('turbolinks:load', function() {
27
+ if (!$.fn.DataTable.isDataTable("table[id^=dttb-]")) {
28
+ $("table[id^=dttb-]").DataTable();
29
+ }
30
+ });