effective_datatables 3.2.6 → 3.2.7

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: a60414a14abdc45d87dbda78636a95a3e9a0b7e1
4
- data.tar.gz: 5c97dbdd9932315966189a6702591e57406623cc
3
+ metadata.gz: ef7002186c955ceea81788574da37e926dde317e
4
+ data.tar.gz: e4bc57451595479713c11d423d2b21b22629eaae
5
5
  SHA512:
6
- metadata.gz: 5b47935fefc03832d781d6f92e37c4254c54db5b41cc1808f152f8c7668912f71c9afdb59b0a37877eb989628577c52f7caca977f4a090590005d86dd336f1c2
7
- data.tar.gz: d77569664a318d3e60b23cbd6533b62ef0049f56e6f11dafef8e9b641bbb7d9c1fb0cde5767aba2739fcae6a3a21f73925d16b9e7d468e448cf987131659aee9
6
+ metadata.gz: 07f99e9baa2ca960349e3fc42949cc14a679109d5156ec8990b7fca81ee24a5abd582a67b07bc2a476da9eb588fc04660944609065c7fc7eaae470d1ed2ebbe1
7
+ data.tar.gz: 867adf502935e2db8dec3171e785ee70039d0a15844ebea9a2858584a2f3a27201f5ecd4bf3918ff9c7ef227b7489559f92c0a66965d22ed45cd1a204914a2f9
@@ -58,7 +58,7 @@ $(document).on 'click', '.buttons-bulk-actions a', (event) ->
58
58
  $processing.html(success)
59
59
  $table.dataTable().data('bulk-actions-restore-selected-values', values)
60
60
  $table.DataTable().draw()
61
- failCallback: ->
61
+ failCallback: ->
62
62
  error = "An error occured while attempting #{title} bulk action"
63
63
  $processing.html(error)
64
64
  alert(error)
@@ -1,4 +1,4 @@
1
- $(document).on 'click', 'a[data-apply-datatable-filters]', (event) ->
1
+ $(document).on 'click', 'a[data-apply-effective-datatables-filters]', (event) ->
2
2
  event.preventDefault()
3
3
  $form = $(event.currentTarget).closest('.effective-datatables-filters')
4
4
  $table = $('#' + $form.attr('aria-controls'))
@@ -3,9 +3,9 @@ initializeDataTables = ->
3
3
  return if $.fn.DataTable.fnIsDataTable(this)
4
4
 
5
5
  datatable = $(this)
6
- simple = ('' + datatable.data('simple') == 'true')
7
6
  input_js_options = datatable.data('input-js-options') || {}
8
7
  buttons_export_columns = input_js_options['buttons_export_columns'] || ':not(.col-actions)'
8
+ simple = ('' + datatable.data('simple') == 'true')
9
9
 
10
10
  if input_js_options['buttons'] == false
11
11
  input_js_options['buttons'] = []
@@ -178,7 +178,7 @@ initializeDataTables = ->
178
178
 
179
179
  if simple
180
180
  init_options['dom'] = "<'row'<'col-sm-12'tr>>" # Just show the table
181
- datatable.addClass('sort-hidden search-hidden')
181
+ datatable.addClass('simple')
182
182
 
183
183
  # Let's actually initialize the table now
184
184
  table = datatable.dataTable(jQuery.extend(init_options, input_js_options))
@@ -27,28 +27,37 @@ table.dataTable thead > tr > th.sorting {
27
27
  padding-right: 18px;
28
28
  }
29
29
 
30
- table.dataTable thead tr th {
31
- text-align: left;
32
- vertical-align: top;
33
- border-bottom: none;
34
- white-space: nowrap;
35
- padding: 6px;
36
-
37
- .form-group { margin-bottom: 0px; font-weight: normal; }
38
- }
30
+ // Search bar
31
+ table.dataTable thead {
32
+ tr th {
33
+ text-align: left;
34
+ vertical-align: top;
35
+ border-bottom: none;
36
+ white-space: nowrap;
37
+ padding: 6px;
38
+ }
39
39
 
40
- // Sorting disabled
41
- table.dataTable.sort-hidden thead .sorting { background-image: none; }
42
- table.dataTable.sort-hidden thead .sorting_asc { background-image: none; }
43
- table.dataTable.sort-hidden thead .sorting_desc { background-image: none; }
40
+ .form-control, .form-group {
41
+ width: 100%;
42
+ font-weight: normal;
43
+ margin-left: 0px;
44
+ margin-right: 0px;
45
+ }
44
46
 
45
- table.dataTable.search-hidden thead .form-group { display: none; }
47
+ .datatable_search__bulk_actions { margin-left: 5px; }
48
+ }
49
+
50
+ // Simple styles
51
+ table.dataTable.simple {
52
+ thead {
53
+ .sorting { background-image: none; cursor: default; }
54
+ .sorting_asc { background-image: none; cursor: default; }
55
+ .sorting_desc { background-image: none; cursor: default; }
46
56
 
47
- // Filter bar
48
- table.dataTable .form-group { width: 100%; margin-left: 0px; margin-right: 0px; }
49
- table.dataTable select { width: 100%; }
50
- table.dataTable .form-control { width: 100%; }
51
- table.dataTable .form-group.datatable_search_bulk_actions { margin-left: 4px; }
57
+ .form-group { display: none; }
58
+ .col-bulk_actions { display: none; }
59
+ }
60
+ }
52
61
 
53
62
  // Processing popup
54
63
  div.dataTables_wrapper div.dataTables_processing {
@@ -61,7 +70,6 @@ div.dataTables_wrapper div.dataTables_processing {
61
70
 
62
71
  // Show x per page
63
72
  .dataTables_wrapper div.dataTables_length {
64
- margin-bottom: 4px;
65
73
  color: #909090;
66
74
  font-size: 12px;
67
75
  }
@@ -135,7 +143,7 @@ ul.dt-button-collection {
135
143
  div.dataTables_wrapper div.dataTables_info {
136
144
  color: #909090;
137
145
  font-size: 12px;
138
- padding: 5px 0px 0px 6px;
146
+ padding: 5px 0px 6px 6px;
139
147
  }
140
148
 
141
149
  // Collapsed responsive view
@@ -144,7 +152,7 @@ table.dataTable > tbody > tr.child span.dtr-data { white-space: nowrap; }
144
152
 
145
153
  table.dataTable.dtr-inline.collapsed > tbody > tr:not(.child) > td:first-child,
146
154
  table.dataTable.dtr-inline.collapsed > tbody > tr:not(.child) > th:first-child {
147
- padding-left: 30px !important;
155
+ padding-left: 30px !important;
148
156
  }
149
157
 
150
158
  // Column specific adjustments
@@ -1,7 +1,7 @@
1
1
  # These are expected to be called by a developer. They are part of the datatables DSL.
2
2
  module EffectiveDatatablesHelper
3
3
 
4
- def render_datatable(datatable, input_js: {}, charts: true, filters: true, simple: false, buttons: true)
4
+ def render_datatable(datatable, input_js: {}, buttons: true, charts: true, filters: true, simple: false)
5
5
  raise 'expected datatable to be present' unless datatable
6
6
 
7
7
  datatable.view ||= self
@@ -14,7 +14,9 @@ module EffectiveDatatablesHelper
14
14
 
15
15
  charts = charts && datatable._charts.present?
16
16
  filters = filters && (datatable._scopes.present? || datatable._filters.present?)
17
- input_js[:buttons] = false unless buttons
17
+
18
+ datatable.attributes[:simple] = true if simple
19
+ input_js[:buttons] = false if simple || !buttons
18
20
 
19
21
  effective_datatable_params = {
20
22
  id: datatable.to_param,
@@ -53,8 +55,6 @@ module EffectiveDatatablesHelper
53
55
 
54
56
  output
55
57
  else
56
- datatable.attributes[:simple] = true if simple
57
-
58
58
  render(partial: 'effective/datatables/datatable',
59
59
  locals: { datatable: datatable, effective_datatable_params: effective_datatable_params }
60
60
  )
@@ -57,12 +57,12 @@ module Effective
57
57
  case opts[:as]
58
58
  when *resource.macros
59
59
  opts[:resource] ||= Effective::Resource.new(resource.associated(name), namespace: controller_namespace)
60
- (opts[:sql_column] = name) if opts[:sql_column].nil?
60
+ opts[:sql_column] = name if opts[:sql_column].nil?
61
61
  when Class
62
62
  if opts[:as].ancestors.include?(ActiveRecord::Base)
63
63
  opts[:resource] = Effective::Resource.new(opts[:as], namespace: controller_namespace)
64
64
  opts[:as] = :resource
65
- (opts[:sql_column] = name) if opts[:sql_column].nil?
65
+ opts[:sql_column] = name if opts[:sql_column].nil?
66
66
  end
67
67
  when :effective_addresses
68
68
  opts[:resource] = Effective::Resource.new(resource.associated(name), namespace: controller_namespace)
@@ -71,9 +71,7 @@ module Effective
71
71
  opts[:sql_column] = :effective_roles
72
72
  when :string # This is the fallback
73
73
  # Anything that doesn't belong to the model or the sql table, we assume is a SELECT SUM|AVG|RANK() as fancy
74
- if (resource.table && resource.column(name).blank?)
75
- opts[:sql_as_column] = true
76
- end
74
+ opts[:sql_as_column] = true if (resource.table && resource.column(name).blank?)
77
75
  end
78
76
  end
79
77
  end
@@ -24,4 +24,4 @@
24
24
  - if datatable._filters_form_required?
25
25
  = form.button :submit, 'Apply', 'data-disable-with': 'Applying...'
26
26
  - else
27
- = link_to 'Apply', '#', class: 'btn btn-primary btn-sm btn-effective-datatables-filters', 'data-apply-datatable-filters': true
27
+ = link_to 'Apply', '#', class: 'btn btn-primary btn-sm btn-effective-datatables-filters', 'data-apply-effective-datatables-filters': true
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '3.2.6'.freeze
2
+ VERSION = '3.2.7'.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: 3.2.6
4
+ version: 3.2.7
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-10-06 00:00:00.000000000 Z
11
+ date: 2017-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails