daru-data_tables 0.1.0 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1aa4862903d3e3efa2d6aeb802c6a36dad7aa86b
4
- data.tar.gz: d2c5bfdef9cf9d81297c158a48e0c93ad45e27d2
3
+ metadata.gz: 1f660b4a3ca5a6cc0f958070666b14269810efbf
4
+ data.tar.gz: 869497cb55c683178b0c7267398689206c9687df
5
5
  SHA512:
6
- metadata.gz: b85f4a026f9dcfc330cdc7ff764998ccc1cb21a9e8b453cf796425e442fc877dc39011f8fe5cb167c44ef60031e80e18c8da06f63c1b90cbc6e3d7694de4ee00
7
- data.tar.gz: ca88214f12668bfb1653ba31ee5ca519f53876945ab0f95707af7f2f47d0f9329c783226a49630d5b9b4865ecc2653235537508d87f2ea26fdb5dd43198978d6
6
+ metadata.gz: e7c38d078a620932d028ee27add03f862c81ff65cda34cb9b20d76fed581174c377309bac66c7359c6564588584d2c2f973c301bf6896253dd8290aec3a92044
7
+ data.tar.gz: 5e055a03905a8ca91ef44b30a9724442929a7cb202f8bbe8f823f5a48c0929ca4c3894026ea762e6e62b3408cb6a255616bea485d1c5d1705195d4abe4499648
Binary file
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
@@ -17,7 +17,7 @@ AllCops:
17
17
  - 'daru-data_tables.gemspec'
18
18
  - '**/*.rake'
19
19
  DisplayCopNames: true
20
- TargetRubyVersion: 2.0
20
+ TargetRubyVersion: 2.2
21
21
 
22
22
  # Preferred codebase style ---------------------------------------------
23
23
  Layout/ExtraSpacing:
@@ -0,0 +1,3 @@
1
+ SimpleCov.start do
2
+ add_group "lib", "lib"
3
+ end
@@ -12,6 +12,9 @@ script:
12
12
  - bundle exec rspec
13
13
  - bundle exec rubocop
14
14
 
15
+ after_script:
16
+ - bundle exec rake coveralls:push
17
+
15
18
  install:
16
19
  - gem install bundler
17
20
  - gem install rainbow -v '2.2.1'
@@ -0,0 +1,42 @@
1
+ ## 0.3.5 (2017-12-03)
2
+
3
+ **Enhancements:**
4
+
5
+ - Load large set of data #20
6
+
7
+ - Renmaed to `Daru::View::DataTable.new(data, options)` from
8
+ `Daru::DataTables::DataTable.new(data, options)` #23
9
+
10
+ - Remove bunch of js lines in rails #23 :
11
+
12
+ Include js in rails app/assets/javascripts/application.js file as:
13
+
14
+ ```
15
+ //= require jquery-latest.min
16
+ //= require jquery.dataTables
17
+
18
+ ```
19
+ CSS files can be included as:
20
+
21
+ ```
22
+ *= require jquery.dataTables
23
+ ```
24
+
25
+ **Note:**
26
+
27
+ * [GSoC 2018 project](https://github.com/SciRuby/daru-view/wiki/GSoC-2018---Progress-Report)
28
+
29
+ * [Wiki page about loading large set in daru-view using daru-data_tables](https://github.com/SciRuby/daru-view/wiki/DataTables-to-load-large-set-data-in-daru-view-table)
30
+
31
+ ## 0.1.0 (2017-09-20)
32
+
33
+ **Features:**
34
+
35
+ - [Discussion at datatables forum](https://github.com/Shekharrajak/daru-data_tables/wiki/Discussion-in-datatables-forum)
36
+
37
+ **NOTE:**
38
+
39
+
40
+ - [GSoC 2017 Blog post](http://shekharrajak.github.io/gsoc_2017_posts/)
41
+
42
+ - [Blog post at SciRuby, how daru-data_table gem is used in daru-view](http://sciruby.com/blog/2017/09/01/gsoc-2017-data-visualization-using-daru-view/)
data/Gemfile CHANGED
@@ -5,3 +5,13 @@ gem "daru", git: 'https://github.com/sciruby/daru.git'
5
5
 
6
6
  # Specify your gem's dependencies in datatables.gemspec
7
7
  gemspec
8
+
9
+
10
+ group :test do
11
+ gem 'coveralls', require: false
12
+ gem 'rspec'
13
+ gem 'simplecov', require: false
14
+ gem 'simplecov-console', require: false
15
+ end
16
+
17
+
data/README.md CHANGED
@@ -1,12 +1,17 @@
1
1
  # data_tables
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/daru-data_tables.svg)](https://badge.fury.io/rb/daru-data_tables)
4
+ [![Build Status](https://travis-ci.org/shekharrajak/daru-data_tables.svg?branch=master)](https://travis-ci.org/shekharrajak/daru-data_tables)
5
+ [![Coverage Status](https://coveralls.io/repos/github/Shekharrajak/daru-data_tables/badge.svg?branch=master)](https://coveralls.io/github/Shekharrajak/daru-data_tables?branch=master)
6
+
3
7
  This is Ruby gem for the jQuery Javascript library. This gem is created to be used in [daru-view](https://guthub.com/shekharrajak/daru-view). It can create table from Daru::DataFrame and Daru::Vector to display in webpages as well as IRuby notebook.
4
8
 
5
9
  DataTable is very useful in loading large dataset and also we can load data into pieces.
6
10
 
7
11
  ## Examples :
8
12
 
9
- - [IRuby notebook examples](http://nbviewer.jupyter.org/github/Shekharrajak/data_tables/tree/master/spec/dummy_iruby/)
13
+ - [Rails examples](https://github.com/Shekharrajak/daru-data_tables/tree/master/spec/dummy_rails)
14
+
10
15
 
11
16
  ## Installation
12
17
 
data/Rakefile CHANGED
@@ -1,4 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
2
  task :default => :spec
3
3
 
4
+ require 'coveralls/rake/task'
5
+ Coveralls::RakeTask.new
6
+
4
7
  import 'lib/tasks/data_tables.rake'
@@ -5,7 +5,7 @@ require "daru/data_tables/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "daru-data_tables"
8
- spec.version = Daru::DataTables::VERSION
8
+ spec.version = Daru::View::VERSION
9
9
  spec.authors = ["shekharrajak"]
10
10
  spec.email = ["shekharstudy@ymail.com"]
11
11
 
@@ -24,9 +24,8 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "rake", "~> 10.0"
25
25
  spec.add_development_dependency 'actionview'
26
26
  spec.add_development_dependency 'byebug'
27
+ spec.add_runtime_dependency 'daru'
27
28
 
28
- spec.add_development_dependency 'rspec', '~> 3.4'
29
- spec.add_development_dependency 'simplecov'
30
29
  spec.add_development_dependency 'pry', '~> 0.10'
31
30
  spec.add_development_dependency 'rubocop'
32
31
  end
@@ -0,0 +1,8 @@
1
+ # DataTables CSS dependencies
2
+ DATATABLES_DEPENDENCIES_CSS = ['jquery.dataTables.css'].freeze
3
+
4
+ # Dependent DataTables JS constants for IRuby notebook
5
+ DATATABLES_DEPENDENCIES_IRUBY = ['jquery.dataTables.js'].freeze
6
+
7
+ # Dependent DataTables JS constants for web frameworks
8
+ DATATABLES_DEPENDENCIES_WEB = ['jquery-latest.min.js', 'jquery.dataTables.js'].freeze
@@ -0,0 +1,10 @@
1
+ class String
2
+ def js_code(true_or_false=true)
3
+ @_datatables_js_code = true_or_false
4
+ self
5
+ end
6
+
7
+ def js_code?
8
+ @_datatables_js_code || false
9
+ end
10
+ end
@@ -1,10 +1,74 @@
1
1
  module Daru
2
- module DataTables
2
+ module View
3
+ class Engine < ::Rails::Engine; end if defined?(Rails)
3
4
  class DataTable
4
- attr_accessor :html_options, :element_id, :options
5
- def initialize(options={})
5
+ attr_accessor :html_options, :element_id, :options, :data
6
+ # @param data [Array, Daru::DataFrame, Daru::Vector] The data provided
7
+ # by the user to generate the datatable
8
+ # @param options [Hash] Various options provided by the user to
9
+ # incorporate in datatable
10
+ # @return Initializes the Daru::DataTables::DataTable object
11
+ # @example
12
+ # vec = Daru::Vector.new([1, 2, 3], name: :a)
13
+ # opts = {searching: false}
14
+ # table = Daru::DataTables::DataTable.new(vec, opts)
15
+ def initialize(data=[], options={})
6
16
  @element_id = options.delete(:element_id) unless options[:element_id].nil?
7
- @options = options.empty? ? nil : options
17
+ @html_options = options.delete(:html_options) unless options[:html_options].nil?
18
+ @html_options ||= default_html_options
19
+ @data = data
20
+ @options = options
21
+ @options[:data] = to_data_array(data)
22
+ row_number = 0
23
+ @options[:data].each do |array|
24
+ array.unshift(row_number)
25
+ row_number += 1
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ def default_html_options
32
+ table_opts = {
33
+ class: 'display',
34
+ cellspacing: '0',
35
+ width: '100%'
36
+ }
37
+ html_options = {
38
+ table_options: table_opts
39
+ }
40
+ html_options
41
+ end
42
+
43
+ # DataTables accept the data as Array of array.
44
+ #
45
+ # TODO : I didn't find use case for Daru::MultiIndex.
46
+ def to_data_array(data_set)
47
+ case
48
+ when data_set.is_a?(Daru::DataFrame)
49
+ return ArgumentError unless data_set.index.is_a?(Daru::Index)
50
+
51
+ rows = data_set.access_row_tuples_by_indexs(*data_set.index.to_a)
52
+ convert_to_array_of_array(rows)
53
+ when data_set.is_a?(Daru::Vector)
54
+ rows = []
55
+ data_set.to_a.each { |a| rows << [a] }
56
+ rows
57
+ when data_set.is_a?(Array)
58
+ convert_to_array_of_array(data_set)
59
+ else
60
+ raise ArgumentError, 'Invalid Argument Passed!'
61
+ end
62
+ end
63
+
64
+ def convert_to_array_of_array(rows)
65
+ if rows.all? { |row| row.class==Array }
66
+ rows
67
+ else
68
+ tuples = []
69
+ rows.each { |row| tuples << [row] }
70
+ tuples
71
+ end
8
72
  end
9
73
  end
10
74
  end
@@ -3,37 +3,59 @@ require 'erb'
3
3
  require_relative 'iruby_notebook'
4
4
  require_relative '../generate_js/generate_js'
5
5
  require 'action_view'
6
+ require 'daru/data_tables/constants_data_table'
6
7
 
7
8
  module Daru
8
- module DataTables
9
- # dependent script for the library. It must be added in the head tag
10
- # of the web application.
11
- #
12
- # @example
13
- #
14
- # dep_js = DataTables.init_script
15
- #
16
- # use in Rails app : <%=raw dep_js %>
17
- #
18
- def self.init_script(
19
- dependent_js=[
20
- 'jquery-latest.min.js', 'jquery.dataTables.js'
21
- ],
22
- dependent_css=['jquery.dataTables.css']
23
- )
24
- # TODO: there are many js and css files, that must be added for
25
- # more features. Refer: https://datatables.net/download/index
26
- js = ''
27
- js << "\n<script type='text/javascript'>"
28
- js << Daru::DataTables.generate_init_code_js(dependent_js)
29
- js << "\n</script>"
30
- js << "\n<style type='text/css'>"
31
- js << Daru::DataTables.generate_init_code_css(dependent_css)
32
- js << "\n</style>"
33
- js
9
+ module View
10
+ class DataTables
11
+ # @param dependent_js [Array] dependent js files required
12
+ # @return [String] js code of the dependent files
13
+ def self.init_javascript(
14
+ dependent_js=DATATABLES_DEPENDENCIES_WEB
15
+ )
16
+ # TODO: there are many js and css files, that must be added for
17
+ # more features. Refer: https://datatables.net/download/index
18
+ js = ''
19
+ js << "\n<script type='text/javascript'>"
20
+ js << Daru::View.generate_init_code_js(dependent_js)
21
+ js << "\n</script>"
22
+ js
23
+ end
24
+
25
+ # @param [Array] dependent css files required
26
+ # @return [String] CSS code of the dependent file(s)
27
+ def self.init_css(
28
+ dependent_css=DATATABLES_DEPENDENCIES_CSS
29
+ )
30
+ css = ''
31
+ css << "\n<style type='text/css'>"
32
+ css << Daru::View.generate_init_code_css(dependent_css)
33
+ css << "\n</style>"
34
+ css
35
+ end
36
+
37
+ # dependent script for the library. It must be added in the head tag
38
+ # of the web application.
39
+ #
40
+ # @return [String] code of the dependent css and js file(s)
41
+ # @example
42
+ #
43
+ # dep_js = DataTables.init_script
44
+ #
45
+ # use in Rails app : <%=raw dep_js %>
46
+ def self.init_script
47
+ init_code = ''
48
+ init_code << init_css
49
+ init_code << init_javascript
50
+ init_code
51
+ end
34
52
  end
35
53
 
36
54
  module Display
55
+ # @param dom [String] The ID of the DIV element that the DataTable
56
+ # should be rendered in
57
+ # @param options [Hash] options provided
58
+ # @return [String] js script to render the table
37
59
  def show_script(dom=SecureRandom.uuid, options={})
38
60
  script_tag = options.fetch(:script_tag) { true }
39
61
  if script_tag
@@ -48,34 +70,36 @@ module Daru
48
70
  # If table_options is not present then it will assume that table tag is
49
71
  # already present in the web page source, where we are pasting the
50
72
  # html code.
73
+ # @param id [String] The ID of the DIV element that the DataTable
74
+ # should be rendered in
75
+ # @param options [Hash] options provided
76
+ # @return [String] Generates JavaScript and renders the table in the
77
+ # final HTML output.
51
78
  def to_html(id=nil, options={})
52
79
  # More things can be added into table_script.erb
53
- path = File.expand_path('../../templates/table_script.erb', __FILE__)
80
+ path = File.expand_path('../templates/table_script.erb', __dir__)
54
81
  template = File.read(path)
55
82
  id ||= SecureRandom.uuid # TODO: remove it or Use it for table tag.
56
- table_script = show_script(id, script_tag: false)
83
+ element_id ||= id
84
+ table_script = show_script(element_id, script_tag: false)
57
85
  html_code = ERB.new(template).result(binding)
58
86
  # table_options is given. That means table html code is not present in
59
87
  # the webpage. So it must generate table code with given options.
60
- unless options[:table_options].nil?
61
- options[:table_options][:id] = id
62
- table_thead_tbody = options[:table_options].delete(:table_html)
63
- table_thead_tbody ||= ''
64
- html_code.concat(
65
- content_tag('table', table_thead_tbody.html_safe, options[:table_options])
66
- )
67
- end
88
+ table_thead = extract_table
89
+ draw_table_thead(element_id, html_code, table_thead)
68
90
  html_code
69
91
  end
70
92
 
93
+ # @param dom [String] The ID of the DIV element that the DataTable
94
+ # should be rendered in
95
+ # @return [void] shows the datatable in IRuby notebook
71
96
  def show_in_iruby(dom=SecureRandom.uuid)
72
97
  IRuby.html(to_html(dom))
73
98
  end
74
99
 
75
- # Generates JavaScript and renders the tabke in the final HTML output.
76
- #
77
- # Parameters:
78
- # *element_id [Required] The ID of the DIV element that the table should be rendered in.
100
+ # @param element_id [String] The ID of the DIV element that the DataTable
101
+ # should be rendered in
102
+ # @return [String] returns the javascript of the DataTable
79
103
  def to_js(element_id)
80
104
  js = ''
81
105
  js << "\n<script type='text/javascript'>"
@@ -83,7 +107,40 @@ module Daru
83
107
  js << "\n</script>"
84
108
  js
85
109
  end
86
- end # module Display end
110
+
111
+ private
112
+
113
+ def extract_table
114
+ return data.to_html_thead unless data.is_a?(Array)
115
+
116
+ path = File.expand_path('../templates/thead.erb', __dir__)
117
+ template = File.read(path)
118
+ ERB.new(template).result(binding)
119
+ end
120
+
121
+ def draw_table_thead(element_id, html_code, table_thead)
122
+ if html_options && html_options[:table_options]
123
+ draw_table_thead_from_html_options(element_id, html_code, table_thead)
124
+ # if user provided html_options but not provided html_options[:table_options]
125
+ else
126
+ html_code.concat(
127
+ content_tag(
128
+ 'table', table_thead.html_safe, id: element_id, class: 'display'
129
+ )
130
+ )
131
+ end
132
+ end
133
+
134
+ def draw_table_thead_from_html_options(element_id, html_code, table_thead)
135
+ html_options[:table_options][:id] = element_id
136
+ html_options[:table_options][:class] ||= 'display'
137
+ table_thead = html_options[:table_options].delete(:table_thead) if
138
+ html_options[:table_options][:table_thead]
139
+ html_code.concat(
140
+ content_tag('table', table_thead.html_safe, html_options[:table_options])
141
+ )
142
+ end
143
+ end
87
144
 
88
145
  class DataTable
89
146
  include ActionView::Helpers::TagHelper # to use content_tag
@@ -1,44 +1,52 @@
1
+ require 'daru/data_tables/constants_data_table'
2
+
1
3
  module Daru
2
- module DataTables
4
+ module View
3
5
  # generate initializing code
4
6
  def self.generate_init_code_js(dependent_js)
5
- js_dir = File.expand_path('../../js', __FILE__)
6
- path = File.expand_path('../../templates/init.inline.js.erb', __FILE__)
7
+ js_dir = File.expand_path(
8
+ '../../../../vendor/assets/javascripts', __dir__
9
+ )
10
+ path = File.expand_path('../templates/init.inline.js.erb', __dir__)
7
11
  template = File.read(path)
8
12
  ERB.new(template).result(binding)
9
13
  end
10
14
 
11
15
  def self.generate_init_code_css(dependent_css)
12
- css_dir = File.expand_path('../../css', __FILE__)
13
- path = File.expand_path('../../templates/init.inline.css.erb', __FILE__)
16
+ css_dir = File.expand_path(
17
+ '../../../../vendor/assets/stylesheets', __dir__
18
+ )
19
+ path = File.expand_path('../templates/init.inline.css.erb', __dir__)
14
20
  template = File.read(path)
15
21
  ERB.new(template).result(binding)
16
22
  end
17
23
 
18
- # Enable to show plots on IRuby notebook.
19
- # Load the dependent JS files in IRuby notebook. Those JS will help in
20
- # plotting the table in IRuby cell.
21
- #
22
- # One can see the loaded JS files in the source code of the notebook.
23
- # @example
24
- #
25
- # DataTables.init_iruby
26
- #
27
- def self.init_iruby(
28
- dependent_js=['jquery.dataTables.js']
29
- )
30
- # dependent_css=['jquery.dataTables.css']
31
- # Note: Jquery is dependecy for DataTables.
32
- # Since Jquery is already a dependency for iruby notebook.
33
- # So it will be loaded into IRuby notebook when `iruby` is run.
34
- # No need to add it in the `dependent_js`.
35
- js = generate_init_code_js(dependent_js)
36
- # TODO: don't know how to import css like js
37
- # css = generate_init_code_css(dependent_css)
38
- IRuby.display(IRuby.javascript(js))
39
- # IRuby.display(css, mime: 'text/stylesheet')
40
- # FixMe: Don't know, how to add css in IRuby notebook (Means there is
41
- # no IRuby.stylesheet(..) method)
24
+ class DataTables
25
+ # Enable to show plots on IRuby notebook.
26
+ # Load the dependent JS files in IRuby notebook. Those JS will help in
27
+ # plotting the table in IRuby cell.
28
+ #
29
+ # One can see the loaded JS files in the source code of the notebook.
30
+ # @example
31
+ #
32
+ # DataTables.init_iruby
33
+ #
34
+ def self.init_iruby(
35
+ dependent_js=DATATABLES_DEPENDENCIES_IRUBY
36
+ )
37
+ # dependent_css=['jquery.dataTables.css']
38
+ # Note: Jquery is dependecy for DataTables.
39
+ # Since Jquery is already a dependency for iruby notebook.
40
+ # So it will be loaded into IRuby notebook when `iruby` is run.
41
+ # No need to add it in the `dependent_js`.
42
+ js = generate_init_code_js(dependent_js)
43
+ # TODO: don't know how to import css like js
44
+ # css = generate_init_code_css(dependent_css)
45
+ IRuby.display(IRuby.javascript(js))
46
+ # IRuby.display(css, mime: 'text/stylesheet')
47
+ # FixMe: Don't know, how to add css in IRuby notebook (Means there is
48
+ # no IRuby.stylesheet(..) method)
49
+ end
42
50
  end
43
51
  end
44
52
  end
@@ -1,38 +1,85 @@
1
1
  require_relative 'param_helpers'
2
+ require_relative '../core_ext/string'
2
3
 
3
4
  module Daru
4
- module DataTables
5
+ module View
5
6
  module JsHelpers
6
- include Daru::DataTables::ParamHelpers
7
+ include Daru::View::ParamHelpers
7
8
 
8
- # Generates JavaScript function for rendering the Table.
9
- #
10
- # Parameters:
11
- # *element_id [Required] The ID of the DIV element that the DataTable should be rendered in.
9
+ # @param id [String] The ID of the DIV element that the DataTable
10
+ # should be rendered in
11
+ # @return [String] Generates JavaScript function for rendering the Table.
12
12
  def draw_js(element_id)
13
+ if options[:data] && options[:data].length >= 50_000
14
+ data_array = extract_data_array
15
+ draw_ajax_option
16
+ end
13
17
  js = ''
14
- # js << "\n$(function() {"
15
18
  js << "\n$(document).ready(function() {"
16
19
  js << "\n"
17
- # js << "\n $('##{element_id}').DataTable("
18
- js << "\n $('##{element_id}').DataTable("
19
- js << "\n #{js_parameters(@options)}"
20
- js << "\n );"
20
+ js << "\n\tvar data_array = #{data_array};" unless options[:data]
21
+ js << "\n\t$('##{element_id}').DataTable("
22
+ js << "\n\t\t#{js_parameters(@options)}"
23
+ js << "\n\t);"
21
24
  js << "\n"
22
25
  js << "\n});"
23
26
  js
24
27
  end
25
28
 
29
+ # @param id [String] The ID of the DIV element that the DataTable
30
+ # should be rendered in
31
+ # @return [String] Generates JavaScript function for rendering the Table
32
+ # in IRuby notebook
26
33
  def draw_js_iruby(element_id)
34
+ if options[:data] && options[:data].length >= 50_000
35
+ data_array = extract_data_array
36
+ draw_ajax_option
37
+ end
27
38
  js = ''
28
39
  js << "\n$( function () {"
29
- js << "\n var table = $('##{element_id}').DataTable("
30
- js << "\n #{js_parameters(@options)}"
31
- js << "\n );"
40
+ js << "\n\tvar data_array = #{data_array};" unless options[:data]
41
+ js << "\n\tvar table = $('##{element_id}').DataTable("
42
+ js << "\n\t\t#{js_parameters(@options)}"
43
+ js << "\n\t);"
32
44
  js << "\n"
33
45
  js << "\n});"
34
46
  js
35
47
  end
36
- end # module JsHelpers end
48
+
49
+ # @return [Array, void] returns data Array if present in the options
50
+ def extract_data_array
51
+ options.delete(:data) unless options[:data].nil?
52
+ end
53
+
54
+ # @return [void] adds serverSide and ajax options
55
+ def draw_ajax_option
56
+ ajax_str = ''
57
+ ajax_str << "\nfunction ( data, callback, settings ) {"
58
+ ajax_str << "\n\tvar out = [];"
59
+ ajax_str << "\n\tfor (var i=data.start; i<data.start+data.length; i++) {"
60
+ ajax_str << "\n\t\tif (i < data_array.length) {"
61
+ ajax_str << "\n\t\t\tout.push( data_array[i] );"
62
+ ajax_str << "\n\t\t}"
63
+ ajax_str << "\n\t}"
64
+ ajax_str << "\n\tsetTimeout( function () {"
65
+ ajax_str << set_callback_ajax
66
+ ajax_str << "\n\t}, 50 );"
67
+ ajax_str << "\n}"
68
+ @options[:serverSide] = true
69
+ @options[:ajax] = ajax_str.js_code
70
+ end
71
+
72
+ # @return [String] returns the callback js from the server
73
+ def set_callback_ajax
74
+ callback_js = ''
75
+ callback_js << "\n\t\tcallback( {"
76
+ callback_js << "\n\t\t\tdraw: data.draw,"
77
+ callback_js << "\n\t\t\tdata: out,"
78
+ callback_js << "\n\t\t\trecordsTotal: data_array.length,"
79
+ callback_js << "\n\t\t\trecordsFiltered: data_array.length,"
80
+ callback_js << "\n\t\t} );"
81
+ callback_js
82
+ end
83
+ end
37
84
  end
38
85
  end
@@ -1,7 +1,7 @@
1
1
  require 'date'
2
2
 
3
3
  module Daru
4
- module DataTables
4
+ module View
5
5
  module ParamHelpers
6
6
  def js_parameters(options)
7
7
  return '' if options.nil?
@@ -26,6 +26,8 @@ module Daru
26
26
  # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize
27
27
  def typecast(value, type=nil)
28
28
  case
29
+ when value.respond_to?(:js_code) && value.js_code?
30
+ value
29
31
  when value.is_a?(String)
30
32
  value.to_json
31
33
  when value.is_a?(Integer) || value.is_a?(Float)
@@ -50,6 +52,8 @@ module Daru
50
52
  value
51
53
  end
52
54
  end
53
- end # module ParamHelpers end
55
+ # rubocop:enable Metrics/PerceivedComplexity, Metrics/MethodLength
56
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize
57
+ end
54
58
  end
55
59
  end
@@ -0,0 +1,15 @@
1
+ <thead>
2
+ <tr>
3
+ <th></th>
4
+ <% column_number = 0 %>
5
+ <% if data.sample.is_a?(Array)%>
6
+ <% columns = data.sample.length - 1 %>
7
+ <% else %>
8
+ <% columns = 1 %>
9
+ <% end %>
10
+ <% columns.times do %>
11
+ <th>Column: <%=column_number%></th>
12
+ <% column_number += 1 %>
13
+ <% end %>
14
+ </tr>
15
+ </thead>
@@ -1,5 +1,5 @@
1
1
  module Daru
2
- module DataTables
3
- VERSION = '0.1.0'.freeze
2
+ module View
3
+ VERSION = '0.3.5'.freeze
4
4
  end
5
5
  end
@@ -10,21 +10,23 @@ end
10
10
  namespace :data_tables do
11
11
  desc "Update datatables javascript and stylesheets dependent files"
12
12
  task :update => [:js, :css, :jquery]
13
+ sh "mkdir -p vendor/assets/javascripts/"
13
14
  task :js do
14
15
  say "Grabbing Core js from datatables codebase..." do
15
- sh "curl -# https://nightly.datatables.net/js/jquery.dataTables.js -L --compressed -o lib/data_tables/js/jquery.dataTables.js"
16
+ sh "curl -# https://nightly.datatables.net/js/jquery.dataTables.js -L --compressed -o vendor/assets/javascripts/jquery.dataTables.js"
16
17
  end
17
18
  end
18
19
 
20
+ sh "mkdir -p vendor/assets/stylesheets/"
19
21
  task :css do
20
22
  say "Grabbing css from the datatables website..." do
21
- sh "curl -# https://nightly.datatables.net/css/jquery.dataTables.css -L --compressed -o lib/data_tables/css/jquery.dataTables.css"
23
+ sh "curl -# https://nightly.datatables.net/css/jquery.dataTables.css -L --compressed -o vendor/assets/stylesheets/jquery.dataTables.css"
22
24
  end
23
25
  end
24
26
 
25
27
  task :jquery do
26
28
  say "Grabbing jquery from the jquery website..." do
27
- sh "curl -# http://code.jquery.com/jquery-latest.min.js -L --compressed -o lib/data_tables/js/jquery-latest.min.js"
29
+ sh "curl -# http://code.jquery.com/jquery-latest.min.js -L --compressed -o vendor/assets/javascripts/jquery-latest.min.js"
28
30
  end
29
31
  end
30
32
  end
@@ -1,15 +1,15 @@
1
- /*! DataTables 1.10.16-dev
2
- * ©2008-2017 SpryMedia Ltd - datatables.net/license
1
+ /*! DataTables 1.10.20-dev
2
+ * ©2008-2018 SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
5
5
  /**
6
6
  * @summary DataTables
7
7
  * @description Paginate, search and order HTML tables
8
- * @version 1.10.16-dev
8
+ * @version 1.10.20-dev
9
9
  * @file jquery.dataTables.js
10
10
  * @author SpryMedia Ltd
11
11
  * @contact www.datatables.net
12
- * @copyright Copyright 2008-2017 SpryMedia Ltd.
12
+ * @copyright Copyright 2008-2018 SpryMedia Ltd.
13
13
  *
14
14
  * This source file is free software, available under the following license:
15
15
  * MIT license - http://datatables.net/license
@@ -909,8 +909,11 @@
909
909
  var s = allSettings[i];
910
910
 
911
911
  /* Base check on table node */
912
- if ( s.nTable == this || s.nTHead.parentNode == this || (s.nTFoot && s.nTFoot.parentNode == this) )
913
- {
912
+ if (
913
+ s.nTable == this ||
914
+ (s.nTHead && s.nTHead.parentNode == this) ||
915
+ (s.nTFoot && s.nTFoot.parentNode == this)
916
+ ) {
914
917
  var bRetrieve = oInit.bRetrieve !== undefined ? oInit.bRetrieve : defaults.bRetrieve;
915
918
  var bDestroy = oInit.bDestroy !== undefined ? oInit.bDestroy : defaults.bDestroy;
916
919
 
@@ -967,11 +970,7 @@
967
970
 
968
971
  // Backwards compatibility, before we apply all the defaults
969
972
  _fnCompatOpts( oInit );
970
-
971
- if ( oInit.oLanguage )
972
- {
973
- _fnLanguageCompat( oInit.oLanguage );
974
- }
973
+ _fnLanguageCompat( oInit.oLanguage );
975
974
 
976
975
  // If the length menu is given, but the init display length is not, use the length menu
977
976
  if ( oInit.aLengthMenu && ! oInit.iDisplayLength )
@@ -1354,8 +1353,10 @@
1354
1353
  // - fr - Swiss Franc
1355
1354
  // - kr - Swedish krona, Norwegian krone and Danish krone
1356
1355
  // - \u2009 is thin space and \u202F is narrow no-break space, both used in many
1356
+ // - Ƀ - Bitcoin
1357
+ // - Ξ - Ethereum
1357
1358
  // standards as thousands separators.
1358
- var _re_formatted_numeric = /[',$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfk]/gi;
1359
+ var _re_formatted_numeric = /[',$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfkɃΞ]/gi;
1359
1360
 
1360
1361
 
1361
1362
  var _empty = function ( d ) {
@@ -1730,33 +1731,43 @@
1730
1731
  */
1731
1732
  function _fnLanguageCompat( lang )
1732
1733
  {
1734
+ // Note the use of the Hungarian notation for the parameters in this method as
1735
+ // this is called after the mapping of camelCase to Hungarian
1733
1736
  var defaults = DataTable.defaults.oLanguage;
1734
- var zeroRecords = lang.sZeroRecords;
1735
1737
 
1736
- /* Backwards compatibility - if there is no sEmptyTable given, then use the same as
1737
- * sZeroRecords - assuming that is given.
1738
- */
1739
- if ( ! lang.sEmptyTable && zeroRecords &&
1740
- defaults.sEmptyTable === "No data available in table" )
1741
- {
1742
- _fnMap( lang, lang, 'sZeroRecords', 'sEmptyTable' );
1738
+ // Default mapping
1739
+ var defaultDecimal = defaults.sDecimal;
1740
+ if ( defaultDecimal ) {
1741
+ _addNumericSort( defaultDecimal );
1743
1742
  }
1744
1743
 
1745
- /* Likewise with loading records */
1746
- if ( ! lang.sLoadingRecords && zeroRecords &&
1747
- defaults.sLoadingRecords === "Loading..." )
1748
- {
1749
- _fnMap( lang, lang, 'sZeroRecords', 'sLoadingRecords' );
1750
- }
1744
+ if ( lang ) {
1745
+ var zeroRecords = lang.sZeroRecords;
1751
1746
 
1752
- // Old parameter name of the thousands separator mapped onto the new
1753
- if ( lang.sInfoThousands ) {
1754
- lang.sThousands = lang.sInfoThousands;
1755
- }
1747
+ // Backwards compatibility - if there is no sEmptyTable given, then use the same as
1748
+ // sZeroRecords - assuming that is given.
1749
+ if ( ! lang.sEmptyTable && zeroRecords &&
1750
+ defaults.sEmptyTable === "No data available in table" )
1751
+ {
1752
+ _fnMap( lang, lang, 'sZeroRecords', 'sEmptyTable' );
1753
+ }
1754
+
1755
+ // Likewise with loading records
1756
+ if ( ! lang.sLoadingRecords && zeroRecords &&
1757
+ defaults.sLoadingRecords === "Loading..." )
1758
+ {
1759
+ _fnMap( lang, lang, 'sZeroRecords', 'sLoadingRecords' );
1760
+ }
1761
+
1762
+ // Old parameter name of the thousands separator mapped onto the new
1763
+ if ( lang.sInfoThousands ) {
1764
+ lang.sThousands = lang.sInfoThousands;
1765
+ }
1756
1766
 
1757
- var decimal = lang.sDecimal;
1758
- if ( decimal ) {
1759
- _addNumericSort( decimal );
1767
+ var decimal = lang.sDecimal;
1768
+ if ( decimal && defaultDecimal !== decimal ) {
1769
+ _addNumericSort( decimal );
1770
+ }
1760
1771
  }
1761
1772
  }
1762
1773
 
@@ -3128,7 +3139,7 @@
3128
3139
  }
3129
3140
  }
3130
3141
 
3131
- _fnCallbackFire( oSettings, 'aoRowCreatedCallback', null, [nTr, rowData, iRow] );
3142
+ _fnCallbackFire( oSettings, 'aoRowCreatedCallback', null, [nTr, rowData, iRow, cells] );
3132
3143
  }
3133
3144
 
3134
3145
  // Remove once webkit bug 131819 and Chromium bug 365619 have been resolved
@@ -3453,7 +3464,7 @@
3453
3464
  // iRowCount and j are not currently documented. Are they at all
3454
3465
  // useful?
3455
3466
  _fnCallbackFire( oSettings, 'aoRowCallback', null,
3456
- [nRow, aoData._aData, iRowCount, j] );
3467
+ [nRow, aoData._aData, iRowCount, j, iDataIndex] );
3457
3468
 
3458
3469
  anRows.push( nRow );
3459
3470
  iRowCount++;
@@ -3857,12 +3868,12 @@
3857
3868
  {
3858
3869
  ajaxData = ajax.data;
3859
3870
 
3860
- var newData = $.isFunction( ajaxData ) ?
3871
+ var newData = typeof ajaxData === 'function' ?
3861
3872
  ajaxData( data, oSettings ) : // fn can manipulate data or return
3862
3873
  ajaxData; // an object object or array to merge
3863
3874
 
3864
3875
  // If the function returned something, use that alone
3865
- data = $.isFunction( ajaxData ) && newData ?
3876
+ data = typeof ajaxData === 'function' && newData ?
3866
3877
  newData :
3867
3878
  $.extend( true, data, newData );
3868
3879
 
@@ -3926,7 +3937,7 @@
3926
3937
  url: ajax || oSettings.sAjaxSource
3927
3938
  } ) );
3928
3939
  }
3929
- else if ( $.isFunction( ajax ) )
3940
+ else if ( typeof ajax === 'function' )
3930
3941
  {
3931
3942
  // Is a function - let the caller define what needs to be done
3932
3943
  oSettings.jqXHR = ajax.call( instance, data, callback, oSettings );
@@ -4809,7 +4820,12 @@
4809
4820
  } );
4810
4821
 
4811
4822
  for ( var i=0, ien=lengths.length ; i<ien ; i++ ) {
4812
- select[0][ i ] = new Option( language[i], lengths[i] );
4823
+ select[0][ i ] = new Option(
4824
+ typeof language[i] === 'number' ?
4825
+ settings.fnFormatNumber( language[i] ) :
4826
+ language[i],
4827
+ lengths[i]
4828
+ );
4813
4829
  }
4814
4830
 
4815
4831
  var div = $('<div><label/></div>').addClass( classes.sLength );
@@ -5355,14 +5371,18 @@
5355
5371
  // both match, but we want to hide it completely. We want to also fix their
5356
5372
  // width to what they currently are
5357
5373
  _fnApplyToChildren( function(nSizer, i) {
5358
- nSizer.innerHTML = '<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+headerContent[i]+'</div>';
5374
+ nSizer.innerHTML = '<div class="dataTables_sizing">'+headerContent[i]+'</div>';
5375
+ nSizer.childNodes[0].style.height = "0";
5376
+ nSizer.childNodes[0].style.overflow = "hidden";
5359
5377
  nSizer.style.width = headerWidths[i];
5360
5378
  }, headerSrcEls );
5361
5379
 
5362
5380
  if ( footer )
5363
5381
  {
5364
5382
  _fnApplyToChildren( function(nSizer, i) {
5365
- nSizer.innerHTML = '<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+footerContent[i]+'</div>';
5383
+ nSizer.innerHTML = '<div class="dataTables_sizing">'+footerContent[i]+'</div>';
5384
+ nSizer.childNodes[0].style.height = "0";
5385
+ nSizer.childNodes[0].style.overflow = "hidden";
5366
5386
  nSizer.style.width = footerWidths[i];
5367
5387
  }, footerSrcEls );
5368
5388
  }
@@ -6556,7 +6576,7 @@
6556
6576
  {
6557
6577
  $(n)
6558
6578
  .on( 'click.DT', oData, function (e) {
6559
- n.blur(); // Remove focus outline for mouse users
6579
+ $(n).blur(); // Remove focus outline for mouse users
6560
6580
  fn(e);
6561
6581
  } )
6562
6582
  .on( 'keypress.DT', oData, function (e){
@@ -7796,13 +7816,26 @@
7796
7816
  }
7797
7817
  }
7798
7818
  else if ( order == 'current' || order == 'applied' ) {
7799
- a = search == 'none' ?
7800
- displayMaster.slice() : // no search
7801
- search == 'applied' ?
7802
- displayFiltered.slice() : // applied search
7803
- $.map( displayMaster, function (el, i) { // removed search
7804
- return $.inArray( el, displayFiltered ) === -1 ? el : null;
7805
- } );
7819
+ if ( search == 'none') {
7820
+ a = displayMaster.slice();
7821
+ }
7822
+ else if ( search == 'applied' ) {
7823
+ a = displayFiltered.slice();
7824
+ }
7825
+ else if ( search == 'removed' ) {
7826
+ // O(n+m) solution by creating a hash map
7827
+ var displayFilteredMap = {};
7828
+
7829
+ for ( var i=0, ien=displayFiltered.length ; i<ien ; i++ ) {
7830
+ displayFilteredMap[displayFiltered[i]] = null;
7831
+ }
7832
+
7833
+ a = $.map( displayMaster, function (el) {
7834
+ return ! displayFilteredMap.hasOwnProperty(el) ?
7835
+ el :
7836
+ null;
7837
+ } );
7838
+ }
7806
7839
  }
7807
7840
  else if ( order == 'index' || order == 'original' ) {
7808
7841
  for ( i=0, ien=settings.aoData.length ; i<ien ; i++ ) {
@@ -7835,14 +7868,13 @@
7835
7868
  * {array} - jQuery array of nodes, or simply an array of TR nodes
7836
7869
  *
7837
7870
  */
7838
-
7839
-
7840
7871
  var __row_selector = function ( settings, selector, opts )
7841
7872
  {
7842
7873
  var rows;
7843
7874
  var run = function ( sel ) {
7844
7875
  var selInt = _intVal( sel );
7845
7876
  var i, ien;
7877
+ var aoData = settings.aoData;
7846
7878
 
7847
7879
  // Short cut - selector is a number and no options provided (default is
7848
7880
  // all records, so no need to check if the index is in there, since it
@@ -7867,23 +7899,26 @@
7867
7899
  // Selector - function
7868
7900
  if ( typeof sel === 'function' ) {
7869
7901
  return $.map( rows, function (idx) {
7870
- var row = settings.aoData[ idx ];
7902
+ var row = aoData[ idx ];
7871
7903
  return sel( idx, row._aData, row.nTr ) ? idx : null;
7872
7904
  } );
7873
7905
  }
7874
7906
 
7875
- // Get nodes in the order from the `rows` array with null values removed
7876
- var nodes = _removeEmpty(
7877
- _pluck_order( settings.aoData, rows, 'nTr' )
7878
- );
7879
-
7880
7907
  // Selector - node
7881
7908
  if ( sel.nodeName ) {
7882
- if ( sel._DT_RowIndex !== undefined ) {
7883
- return [ sel._DT_RowIndex ]; // Property added by DT for fast lookup
7909
+ var rowIdx = sel._DT_RowIndex; // Property added by DT for fast lookup
7910
+ var cellIdx = sel._DT_CellIndex;
7911
+
7912
+ if ( rowIdx !== undefined ) {
7913
+ // Make sure that the row is actually still present in the table
7914
+ return aoData[ rowIdx ] && aoData[ rowIdx ].nTr === sel ?
7915
+ [ rowIdx ] :
7916
+ [];
7884
7917
  }
7885
- else if ( sel._DT_CellIndex ) {
7886
- return [ sel._DT_CellIndex.row ];
7918
+ else if ( cellIdx ) {
7919
+ return aoData[ cellIdx.row ] && aoData[ cellIdx.row ].nTr === sel.parentNode ?
7920
+ [ cellIdx.row ] :
7921
+ [];
7887
7922
  }
7888
7923
  else {
7889
7924
  var host = $(sel).closest('*[data-dt-row]');
@@ -7912,6 +7947,11 @@
7912
7947
  // need to fall through to jQuery in case there is DOM id that
7913
7948
  // matches
7914
7949
  }
7950
+
7951
+ // Get nodes in the order from the `rows` array with null values removed
7952
+ var nodes = _removeEmpty(
7953
+ _pluck_order( settings.aoData, rows, 'nTr' )
7954
+ );
7915
7955
 
7916
7956
  // Selector - jQuery selector string, array of nodes or jQuery object/
7917
7957
  // As jQuery's .filter() allows jQuery objects to be passed in filter,
@@ -8031,6 +8071,11 @@
8031
8071
  _fnDeleteIndex( settings.aiDisplay, row );
8032
8072
  _fnDeleteIndex( that[ thatIdx ], row, false ); // maintain local indexes
8033
8073
 
8074
+ // For server-side processing tables - subtract the deleted row from the count
8075
+ if ( settings._iRecordsDisplay > 0 ) {
8076
+ settings._iRecordsDisplay--;
8077
+ }
8078
+
8034
8079
  // Check for an 'overflow' they case for displaying the table
8035
8080
  _fnLengthOverflow( settings );
8036
8081
 
@@ -8101,7 +8146,13 @@
8101
8146
  }
8102
8147
 
8103
8148
  // Set
8104
- ctx[0].aoData[ this[0] ]._aData = data;
8149
+ var row = ctx[0].aoData[ this[0] ];
8150
+ row._aData = data;
8151
+
8152
+ // If the DOM has an id, and the data source is an array
8153
+ if ( $.isArray( data ) && row.nTr.id ) {
8154
+ _fnSetObjectDataFn( ctx[0].rowId )( data, row.nTr.id );
8155
+ }
8105
8156
 
8106
8157
  // Automatically invalidate
8107
8158
  _fnInvalidate( ctx[0], this[0], 'data' );
@@ -8527,6 +8578,12 @@
8527
8578
  _fnDrawHead( settings, settings.aoHeader );
8528
8579
  _fnDrawHead( settings, settings.aoFooter );
8529
8580
 
8581
+ // Update colspan for no records display. Child rows and extensions will use their own
8582
+ // listeners to do this - only need to update the empty table item here
8583
+ if ( ! settings.aiDisplay.length ) {
8584
+ $(settings.nTBody).find('td[colspan]').attr('colspan', _fnVisbleColumns(settings));
8585
+ }
8586
+
8530
8587
  _fnSaveState( settings );
8531
8588
  };
8532
8589
 
@@ -8692,7 +8749,10 @@
8692
8749
 
8693
8750
  // Selector - index
8694
8751
  if ( $.isPlainObject( s ) ) {
8695
- return [s];
8752
+ // Valid cell index and its in the array of selectable rows
8753
+ return s.column !== undefined && s.row !== undefined && $.inArray( s.row, rows ) !== -1 ?
8754
+ [s] :
8755
+ [];
8696
8756
  }
8697
8757
 
8698
8758
  // Selector - jQuery filtered cells
@@ -8755,12 +8815,19 @@
8755
8815
  } );
8756
8816
  }
8757
8817
 
8818
+ // The default built in options need to apply to row and columns
8819
+ var internalOpts = opts ? {
8820
+ page: opts.page,
8821
+ order: opts.order,
8822
+ search: opts.search
8823
+ } : {};
8824
+
8758
8825
  // Row + column selector
8759
- var columns = this.columns( columnSelector, opts );
8760
- var rows = this.rows( rowSelector, opts );
8826
+ var columns = this.columns( columnSelector, internalOpts );
8827
+ var rows = this.rows( rowSelector, internalOpts );
8761
8828
  var a, i, ien, j, jen;
8762
8829
 
8763
- var cells = this.iterator( 'table', function ( settings, idx ) {
8830
+ this.iterator( 'table', function ( settings, idx ) {
8764
8831
  a = [];
8765
8832
 
8766
8833
  for ( i=0, ien=rows[idx].length ; i<ien ; i++ ) {
@@ -8771,10 +8838,11 @@
8771
8838
  } );
8772
8839
  }
8773
8840
  }
8774
-
8775
- return a;
8776
8841
  }, 1 );
8777
8842
 
8843
+ // Now pass through the cell selector for options
8844
+ var cells = this.cells( a, opts );
8845
+
8778
8846
  $.extend( cells.selector, {
8779
8847
  cols: columnSelector,
8780
8848
  rows: rowSelector,
@@ -9402,7 +9470,7 @@
9402
9470
  * @type string
9403
9471
  * @default Version number
9404
9472
  */
9405
- DataTable.version = "1.10.16-dev";
9473
+ DataTable.version = "1.10.20-dev";
9406
9474
 
9407
9475
  /**
9408
9476
  * Private data store, containing all of the settings objects that are
@@ -12340,8 +12408,8 @@
12340
12408
  * { "data": "engine" },
12341
12409
  * { "data": "browser" },
12342
12410
  * { "data": "platform.inner" },
12343
- * { "data": "platform.details.0" },
12344
- * { "data": "platform.details.1" }
12411
+ * { "data": "details.0" },
12412
+ * { "data": "details.1" }
12345
12413
  * ]
12346
12414
  * } );
12347
12415
  * } );
@@ -14138,7 +14206,7 @@
14138
14206
  * $.fn.dataTable.ext.type.detect.push(
14139
14207
  * function ( data, settings ) {
14140
14208
  * // Check the numeric part
14141
- * if ( ! $.isNumeric( data.substring(1) ) ) {
14209
+ * if ( ! data.substring(1).match(/[0-9]/) ) {
14142
14210
  * return null;
14143
14211
  * }
14144
14212
  *
@@ -14721,7 +14789,8 @@
14721
14789
  $.extend( _ext.type.order, {
14722
14790
  // Dates
14723
14791
  "date-pre": function ( d ) {
14724
- return Date.parse( d ) || -Infinity;
14792
+ var ts = Date.parse( d );
14793
+ return isNaN(ts) ? -Infinity : ts;
14725
14794
  },
14726
14795
 
14727
14796
  // html
@@ -14912,7 +14981,8 @@
14912
14981
 
14913
14982
  text: function () {
14914
14983
  return {
14915
- display: __htmlEscapeEntities
14984
+ display: __htmlEscapeEntities,
14985
+ filter: __htmlEscapeEntities
14916
14986
  };
14917
14987
  }
14918
14988
  };
@@ -15037,6 +15107,7 @@
15037
15107
  _fnRenderer: _fnRenderer,
15038
15108
  _fnDataSource: _fnDataSource,
15039
15109
  _fnRowAttributes: _fnRowAttributes,
15110
+ _fnExtend: _fnExtend,
15040
15111
  _fnCalculateEnd: function () {} // Used by a lot of plug-ins, but redundant
15041
15112
  // in 1.10, so this dead-end function is
15042
15113
  // added to prevent errors
@@ -414,7 +414,7 @@ table.dataTable td {
414
414
  .dataTables_wrapper.no-footer .dataTables_scrollBody {
415
415
  border-bottom: 1px solid #111111;
416
416
  }
417
- .dataTables_wrapper.no-footer div.dataTables_scrollHead > table,
417
+ .dataTables_wrapper.no-footer div.dataTables_scrollHead table.dataTable,
418
418
  .dataTables_wrapper.no-footer div.dataTables_scrollBody > table {
419
419
  border-bottom: none;
420
420
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daru-data_tables
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - shekharrajak
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-20 00:00:00.000000000 Z
11
+ date: 2018-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,27 +67,13 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '3.4'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '3.4'
83
- - !ruby/object:Gem::Dependency
84
- name: simplecov
70
+ name: daru
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - ">="
88
74
  - !ruby/object:Gem::Version
89
75
  version: '0'
90
- type: :development
76
+ type: :runtime
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
@@ -129,9 +115,12 @@ executables: []
129
115
  extensions: []
130
116
  extra_rdoc_files: []
131
117
  files:
118
+ - ".CHANGELOG.md.swp"
132
119
  - ".gitignore"
133
120
  - ".rubocop.yml"
121
+ - ".simplecov"
134
122
  - ".travis.yml"
123
+ - CHANGELOG.md
135
124
  - CODE_OF_CONDUCT.md
136
125
  - Gemfile
137
126
  - LICENSE.txt
@@ -139,20 +128,23 @@ files:
139
128
  - Rakefile
140
129
  - daru-data_tables.gemspec
141
130
  - lib/daru/data_tables.rb
142
- - lib/daru/data_tables/css/jquery.dataTables.css
131
+ - lib/daru/data_tables/constants_data_table.rb
132
+ - lib/daru/data_tables/core_ext/string.rb
143
133
  - lib/daru/data_tables/data_table.rb
144
134
  - lib/daru/data_tables/display/display.rb
145
135
  - lib/daru/data_tables/display/iruby_notebook.rb
146
136
  - lib/daru/data_tables/generate_js/generate_js.rb
147
137
  - lib/daru/data_tables/generate_js/param_helpers.rb
148
- - lib/daru/data_tables/js/jquery-latest.min.js
149
- - lib/daru/data_tables/js/jquery.dataTables.js
150
138
  - lib/daru/data_tables/templates/init.inline.css.erb
151
139
  - lib/daru/data_tables/templates/init.inline.js.erb
152
140
  - lib/daru/data_tables/templates/table_script.erb
141
+ - lib/daru/data_tables/templates/thead.erb
153
142
  - lib/daru/data_tables/version.rb
154
143
  - lib/tasks/data_tables.rake
155
144
  - travis.yaml
145
+ - vendor/assets/javascripts/jquery-latest.min.js
146
+ - vendor/assets/javascripts/jquery.dataTables.js
147
+ - vendor/assets/stylesheets/jquery.dataTables.css
156
148
  homepage: https://github.com/shekharrajak/data_tables
157
149
  licenses:
158
150
  - MIT