effective_datatables 4.34.0 → 4.35.0
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 +4 -4
- data/app/assets/javascripts/effective_datatables/initialize.js.coffee +4 -0
- data/app/assets/javascripts/effective_datatables/inline_crud.js.coffee +1 -0
- data/app/assets/javascripts/effective_datatables/nested.js.coffee +5 -0
- data/app/assets/stylesheets/effective_datatables/_overrides.bootstrap4.scss +9 -0
- data/app/helpers/effective_datatables_helper.rb +10 -1
- data/app/models/effective/effective_datatable/dsl.rb +4 -1
- data/lib/effective_datatables/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce86a4ccf56b39946b075599ac4c146cab3b95f420d0f1a4eb2bca95b9b15594
|
4
|
+
data.tar.gz: 7b98dfd5a1996035256c8c7ee7047541b461ffce0268672b2d9327996988b252
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c780a6949308cfd9f560ddc52be61f3822b85ddf6ca904b2b238a33a6507f59fc6cfccf4a3676c5429219950a996b3ca0f87b16d6d7b253657f00b3a7f2cd7e1
|
7
|
+
data.tar.gz: 0da2df1d7a30190a6211c2dec883309e041ef46ec3c8536fab3ea11bc11ebcf9738debb79bcb3ca421c320b04afd2f9251f29dc31dbccd8cbea27d8538613fdd
|
@@ -3,6 +3,7 @@ initializeDataTables = (target) ->
|
|
3
3
|
datatable = $(this)
|
4
4
|
options = datatable.data('options') || {}
|
5
5
|
buttons_export_columns = options['buttons_export_columns'] || ':not(.col-actions)'
|
6
|
+
nested = datatable.data('nested')
|
6
7
|
reorder = datatable.data('reorder')
|
7
8
|
|
8
9
|
if datatable.data('inline') && datatable.closest('form').length > 0
|
@@ -178,6 +179,9 @@ initializeDataTables = (target) ->
|
|
178
179
|
if reorder
|
179
180
|
table.DataTable().on('row-reorder', (event, diff, edit) -> $(event.target).DataTable().reorder(event, diff, edit))
|
180
181
|
|
182
|
+
if nested
|
183
|
+
table.closest('.dataTables_wrapper').addClass('dataTables_wrapper_nested')
|
184
|
+
|
181
185
|
table.addClass('initialized')
|
182
186
|
table.children('thead').trigger('effective-bootstrap:initialize')
|
183
187
|
table.children('thead').find('input[autofocus]').first().focus()
|
@@ -9,6 +9,7 @@ $(document).on 'ajax:before', '.dataTables_wrapper .col-actions', (event) ->
|
|
9
9
|
$table = $(event.target).closest('table')
|
10
10
|
|
11
11
|
return true if ('' + $action.data('inline')) == 'false'
|
12
|
+
return true if ('' + $action.data('nested-datatable-action')) == 'true'
|
12
13
|
|
13
14
|
$params = $.param(
|
14
15
|
{
|
@@ -103,6 +103,15 @@ table.dataTable thead {
|
|
103
103
|
}
|
104
104
|
}
|
105
105
|
|
106
|
+
// When Inline Expanded with Nested
|
107
|
+
.dataTables_wrapper.effective-datatables-inline-expanded {
|
108
|
+
.dataTables_wrapper_nested {
|
109
|
+
.dt-buttons { opacity: inherit; }
|
110
|
+
.dataTables_entries { opacity: inherit; }
|
111
|
+
.dataTables_paginate { opacity: inherit; }
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
106
115
|
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
|
107
116
|
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
|
108
117
|
color: #0275d8;
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# These are expected to be called by a developer. They are part of the datatables DSL.
|
4
4
|
module EffectiveDatatablesHelper
|
5
|
-
def render_datatable(datatable, input_js: {}, buttons: true, charts: true, download: nil, entries: true, filters: true, inline: false, namespace: nil, pagination: true, search: true, simple: false, short: false, sort: true)
|
5
|
+
def render_datatable(datatable, input_js: {}, buttons: true, charts: true, download: nil, entries: true, filters: true, inline: false, namespace: nil, nested: false, pagination: true, search: true, simple: false, short: false, sort: true)
|
6
6
|
raise 'expected datatable to be present' unless datatable
|
7
7
|
raise 'expected input_js to be a Hash' unless input_js.kind_of?(Hash)
|
8
8
|
|
@@ -19,6 +19,7 @@ module EffectiveDatatablesHelper
|
|
19
19
|
end
|
20
20
|
|
21
21
|
datatable.attributes[:inline] = true if inline
|
22
|
+
datatable.attributes[:nested] = true if nested
|
22
23
|
datatable.attributes[:sortable] = false unless sort
|
23
24
|
datatable.attributes[:searchable] = false unless search
|
24
25
|
datatable.attributes[:downloadable] = false unless download
|
@@ -68,6 +69,7 @@ module EffectiveDatatablesHelper
|
|
68
69
|
'inline' => inline.to_s,
|
69
70
|
'language' => EffectiveDatatables.language(I18n.locale),
|
70
71
|
'length-menu' => datatable_length_menu(datatable),
|
72
|
+
'nested' => nested.to_s,
|
71
73
|
'options' => input_js.to_json,
|
72
74
|
'reorder' => datatable.reorder?.to_s,
|
73
75
|
'reorder-index' => (datatable.columns[:_reorder][:index] if datatable.reorder?).to_s,
|
@@ -133,4 +135,11 @@ module EffectiveDatatablesHelper
|
|
133
135
|
@_inline_datatable ||= datatable
|
134
136
|
end
|
135
137
|
|
138
|
+
def nested_datatable_link_to(title, path, options = {})
|
139
|
+
options[:class] ||= 'btn btn-sm btn-link'
|
140
|
+
options['data-remote'] = true
|
141
|
+
options['data-nested-datatable-action'] = true
|
142
|
+
|
143
|
+
link_to(title, path, options)
|
144
|
+
end
|
136
145
|
end
|
@@ -5,7 +5,10 @@ module Effective
|
|
5
5
|
module Dsl
|
6
6
|
|
7
7
|
def bulk_actions(&block)
|
8
|
-
define_method('initialize_bulk_actions')
|
8
|
+
define_method('initialize_bulk_actions') do
|
9
|
+
actions = dsl_tool.instance_exec(&block)
|
10
|
+
dsl_tool.bulk_actions_col if actions.present?
|
11
|
+
end
|
9
12
|
end
|
10
13
|
|
11
14
|
def charts(&block)
|
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: 4.
|
4
|
+
version: 4.35.0
|
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: 2025-
|
11
|
+
date: 2025-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- app/assets/javascripts/effective_datatables/flash.js.coffee
|
119
119
|
- app/assets/javascripts/effective_datatables/initialize.js.coffee
|
120
120
|
- app/assets/javascripts/effective_datatables/inline_crud.js.coffee
|
121
|
+
- app/assets/javascripts/effective_datatables/nested.js.coffee
|
121
122
|
- app/assets/javascripts/effective_datatables/overrides.js.coffee
|
122
123
|
- app/assets/javascripts/effective_datatables/params.js.coffee
|
123
124
|
- app/assets/javascripts/effective_datatables/reorder.js.coffee
|