effective_datatables 2.12.0 → 2.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 672de368787ac30eb2d42e8bfcde9cba24a61e98
4
- data.tar.gz: fe3cb8fd151b68c9da65fd9f81fb949fa86caead
3
+ metadata.gz: 1ee8baa7089062ecb467e023374ca3ee9f8b5e9b
4
+ data.tar.gz: 54808a68095bbdc2950e329be40a0f195d81a44b
5
5
  SHA512:
6
- metadata.gz: bdffcce1d831eb5d0e27a5242257647a717d043ee64799d264b3bbdd31b6b460c70a05b9ad14294fa981bfd9dd78c44310e1cf153428e25dc943656d2bfb945e
7
- data.tar.gz: b831ffff4efc8d3b154e4d93747d155d90037b874293ffb786d3c2daaf8fcc4ed750ef59ff11da74dddc3ea2757d3af35c71b013210b035825b5942db91bde33
6
+ metadata.gz: ac424c688acd674ee6edd14791d1ffab0258c91e4f06e1b4dde28bb1d8bb4f73f62e4f74b681bd8b9afcbe623cedd7ff930df382d5ec1525a58eb4e1dc63142b
7
+ data.tar.gz: abb7e1eeadd0153336d59501cbc241964c1d6815ea6393f4e2c862f8c89cef9be1bba8d4499bc5e0fc9d3ff703e5934227e44ab0daf889d1c91359c5a6d0a4fe
@@ -1,4 +1,16 @@
1
1
  initializeCharts = ->
2
+ $charts = $('.effective-datatables-chart:not(.initialized)')
3
+ return unless $charts.length > 0
4
+
5
+ if typeof(google) != 'undefined' && typeof(google.charts) != 'undefined'
6
+ google.charts.load('current', { packages: ['corechart'] })
7
+ google.charts.setOnLoadCallback(renderCharts)
8
+
9
+ $charts.addClass('initialized')
10
+
11
+ renderCharts = ->
12
+ return if (typeof(google) == 'undefined' || typeof(google.visualization) == 'undefined')
13
+
2
14
  $('.effective-datatables-chart').each ->
3
15
  $chart = $(this)
4
16
 
@@ -6,9 +18,8 @@ initializeCharts = ->
6
18
  type = $chart.data('type') || 'BarChart'
7
19
  options = $chart.data('options') || {}
8
20
 
9
- if google
10
- chart = new google.visualization[type](document.getElementById($chart.attr('id')))
11
- chart.draw(google.visualization.arrayToDataTable(data), options)
21
+ chart = new google.visualization[type](document.getElementById($chart.attr('id')))
22
+ chart.draw(google.visualization.arrayToDataTable(data), options)
12
23
 
13
24
  $ -> initializeCharts()
14
25
  $(document).on 'page:change', -> initializeCharts()
@@ -119,10 +119,11 @@ initializeDataTables = ->
119
119
  $.each values, (col, value) => $row.children().eq(col).html(value)
120
120
 
121
121
  drawCharts = ($table, charts) ->
122
- $.each charts, (name, data) =>
123
- $(".effective-datatables-chart[data-name='#{name}']").each (_, obj) =>
124
- chart = new google.visualization[data['type']](obj)
125
- chart.draw(google.visualization.arrayToDataTable(data['data']), data['options'])
122
+ if typeof(google) != 'undefined' && typeof(google.visualization) != 'undefined'
123
+ $.each charts, (name, data) =>
124
+ $(".effective-datatables-chart[data-name='#{name}']").each (_, obj) =>
125
+ chart = new google.visualization[data['type']](obj)
126
+ chart.draw(google.visualization.arrayToDataTable(data['data']), data['options'])
126
127
 
127
128
  # Appends the filter html, stored in the column definitions, into each column header
128
129
  initializeFilters = (api) ->
@@ -1,16 +1,16 @@
1
- // Use asset_data_uri to prevent 3 additional GET requests for icons
1
+ // Use asset-data-url to prevent 3 additional GET requests for icons
2
2
  table.dataTable thead .sorting {
3
- background-image: url(<%= asset_data_uri('dataTables/sort_both.png') %>);
3
+ background-image: asset-data-url('dataTables/sort_both.png');
4
4
  background-position: 100% 70%;
5
5
  }
6
6
 
7
7
  table.dataTable thead .sorting_asc {
8
- background-image: url(<%= asset_data_uri('dataTables/sort_asc.png') %>);
8
+ background-image: asset-data-url('dataTables/sort_asc.png');
9
9
  background-position: 100% 70%;
10
10
  }
11
11
 
12
12
  table.dataTable thead .sorting_desc {
13
- background-image: url(<%= asset_data_uri('dataTables/sort_desc.png') %>);
13
+ background-image: asset-data-url('dataTables/sort_desc.png');
14
14
  background-position: 100% 70%;
15
15
  }
16
16
 
@@ -37,11 +37,6 @@ table.dataTable thead tr th {
37
37
  .form-group { margin-bottom: 0px; font-weight: normal; }
38
38
  }
39
39
 
40
- table.dataTable td ul {
41
- list-style: none;
42
- padding-left: 0;
43
- }
44
-
45
40
  // Sorting disabled
46
41
  table.dataTable.sort-hidden thead .sorting { background-image: none; }
47
42
  table.dataTable.sort-hidden thead .sorting_asc { background-image: none; }
@@ -58,9 +58,7 @@ module EffectiveDatatablesHelper
58
58
  datatable.view ||= self
59
59
 
60
60
  unless @effective_datatables_chart_javascript_rendered
61
- concat javascript_include_tag('https://www.google.com/jsapi')
62
- concat javascript_tag("if(google && google.visualization === undefined) { google.load('visualization', '1', {packages:#{EffectiveDatatables.google_chart_packages}}); }")
63
-
61
+ concat javascript_include_tag('https://www.gstatic.com/charts/loader.js', data: { 'turbolinks-track' => :reload, 'turbolinks-eval' => false })
64
62
  @effective_datatables_chart_javascript_rendered = true
65
63
  end
66
64
 
@@ -49,7 +49,7 @@ module Effective
49
49
  @display_entries ||= begin
50
50
  entries = (@default_entries.presence || EffectiveDatatables.default_entries)
51
51
  entries = -1 if entries.to_s.downcase == 'all'
52
- [10, 25, 50, 100, 250, 1000, -1].include?(entries) ? entries : 25
52
+ [5, 10, 25, 50, 100, 250, 1000, -1].include?(entries) ? entries : 25
53
53
  end
54
54
  end
55
55
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '2.12.0'.freeze
2
+ VERSION = '2.12.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_datatables
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.0
4
+ version: 2.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-07 00:00:00.000000000 Z
11
+ date: 2017-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -133,7 +133,7 @@ files:
133
133
  - app/assets/stylesheets/dataTables/dataTables.bootstrap.css
134
134
  - app/assets/stylesheets/dataTables/responsive/responsive.bootstrap.css
135
135
  - app/assets/stylesheets/effective_datatables.scss
136
- - app/assets/stylesheets/effective_datatables/_overrides.scss.erb
136
+ - app/assets/stylesheets/effective_datatables/_overrides.scss
137
137
  - app/assets/stylesheets/effective_datatables/_scopes.scss
138
138
  - app/controllers/effective/datatables_controller.rb
139
139
  - app/helpers/effective_datatables_controller_helper.rb