effective_datatables 4.35.0 → 4.35.2

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
  SHA256:
3
- metadata.gz: ce86a4ccf56b39946b075599ac4c146cab3b95f420d0f1a4eb2bca95b9b15594
4
- data.tar.gz: 7b98dfd5a1996035256c8c7ee7047541b461ffce0268672b2d9327996988b252
3
+ metadata.gz: 8c0318b305009b42544b46dc2defe192f91cd2c255b4b9efa2b5b81776e87d9d
4
+ data.tar.gz: 7bde6317bccfcca632296079b547ef3f51df570ae09e704b484022ec543c9b27
5
5
  SHA512:
6
- metadata.gz: c780a6949308cfd9f560ddc52be61f3822b85ddf6ca904b2b238a33a6507f59fc6cfccf4a3676c5429219950a996b3ca0f87b16d6d7b253657f00b3a7f2cd7e1
7
- data.tar.gz: 0da2df1d7a30190a6211c2dec883309e041ef46ec3c8536fab3ea11bc11ebcf9738debb79bcb3ca421c320b04afd2f9251f29dc31dbccd8cbea27d8538613fdd
6
+ metadata.gz: 6a9c44fccacd5453f60e120a318c21b4af9599682ba9fc4f5c163f978b5b6a828e0ad091f38ca7a71a7650445d5aa6c796ebf0d2fb5a904b0433265f21395878
7
+ data.tar.gz: a72b8e0f01ebb92b0f57a9b1cb21ae9a0d958c9e0ebdad6bf1b5dd9227a1122f23bf3728ed44f8e8d2367355cee7d9f09d361a4f03093bdffe6d2afb48ed4b8c
@@ -9,7 +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
+ return true if ('' + $action.data('nested-datatable')) == 'true'
13
13
 
14
14
  $params = $.param(
15
15
  {
@@ -157,7 +157,12 @@ afterEdit = ($action) ->
157
157
  $tr = $action.closest('tr')
158
158
  $table = $tr.closest('table')
159
159
 
160
- html = buildRow($tr.children('td').length, EffectiveForm.remote_form_payload)
160
+ nestedDatatableAction = $tr.find('a[data-nested-datatable]')
161
+
162
+ html = if nestedDatatableAction.length > 0
163
+ buildNestedDatatableRow($tr.children('td').length, EffectiveForm.remote_form_payload, nestedDatatableAction.attr('title'))
164
+ else
165
+ buildRow($tr.children('td').length, EffectiveForm.remote_form_payload)
161
166
 
162
167
  $tr.data('inline-form-original-html', $tr.children().detach())
163
168
  $tr.html(html)
@@ -201,6 +206,12 @@ buildRow = (length, payload) ->
201
206
  "<a href='#' class='btn btn-sm btn-outline-primary' title='Cancel' data-role='inline-form-cancel'>Cancel</a>" +
202
207
  "</td>"
203
208
 
209
+ buildNestedDatatableRow = (length, payload, title) ->
210
+ "<td class='col-inline-form' colspan='#{length-1}'><div class='nested-datatable-container-parent'><div class='nested-datatable-container'><div class='nested-datatable-title'>#{title || ''}</div>#{payload}</div></div></td>" +
211
+ "<td class='col-actions col-actions-inline-form'>" +
212
+ "<a href='#' class='btn btn-sm btn-outline-primary' title='Cancel' data-role='inline-form-cancel'>Cancel</a>" +
213
+ "</td>"
214
+
204
215
  expand = ($table) ->
205
216
  $wrapper = $table.closest('.dataTables_wrapper').addClass('effective-datatables-inline-expanded')
206
217
  $table.on 'draw.dt', (event) ->
@@ -72,7 +72,7 @@ table.dataTable > thead .sorting_desc {
72
72
  table.dataTable thead {
73
73
  th.col-actions {
74
74
  text-align: right;
75
- span { display: block; height: 1.25em; }
75
+ span { display: block; }
76
76
  }
77
77
  }
78
78
 
@@ -184,6 +184,10 @@ table.dataTable > thead {
184
184
  p { margin-bottom: 0; }
185
185
  }
186
186
 
187
+ .form-group.datatables-filters-present {
188
+ margin-top: 1.75em;
189
+ }
190
+
187
191
  // Processing div
188
192
  div.dataTables_wrapper div.dataTables_processing {
189
193
  margin: -26px 25% 0px 25%;
@@ -321,3 +325,14 @@ div.dt-button-collection .dt-button-active:after {
321
325
  right: auto;
322
326
  left: 0.5rem;
323
327
  }
328
+
329
+ // Nested Datatables
330
+ .nested-datatable-container-parent {
331
+ padding-left: 0.25em;
332
+ padding-right: 0.25em;
333
+ container-type: inline-size;
334
+ }
335
+
336
+ .nested-datatable-container {
337
+ width: 100%;
338
+ }
@@ -138,7 +138,7 @@ module EffectiveDatatablesHelper
138
138
  def nested_datatable_link_to(title, path, options = {})
139
139
  options[:class] ||= 'btn btn-sm btn-link'
140
140
  options['data-remote'] = true
141
- options['data-nested-datatable-action'] = true
141
+ options['data-nested-datatable'] = true
142
142
 
143
143
  link_to(title, path, options)
144
144
  end
@@ -118,8 +118,13 @@ module Effective
118
118
  raise("please use actions_col instead of col(#{name}, as: :actions)")
119
119
  when :boolean
120
120
  label = view.t("effective_datatables.boolean_#{value}")
121
- color = value ? EffectiveDatatables.format_true : EffectiveDatatables.format_false
122
- color.present? ? view.badge(label, color) : label
121
+
122
+ if csv
123
+ label.to_s
124
+ else
125
+ color = value ? EffectiveDatatables.format_true : EffectiveDatatables.format_false
126
+ color.present? ? view.badge(label, color) : label
127
+ end
123
128
  when :currency
124
129
  view.number_to_currency(value)
125
130
  when :date
@@ -11,7 +11,7 @@
11
11
  - else
12
12
  = datatable_filter_tag(form, datatable, name, opts)
13
13
 
14
- .form-group.col-auto
14
+ .form-group.col-auto{class: (datatable._filters.present? ? 'datatables-filters-present' : 'datatables-filters-blank')}
15
15
  - if datatable._filters_form_required?
16
16
  = form.save t('effective_datatables.apply'), 'data-disable-with': t('effective_datatables.applying'), class: 'btn btn-sm btn-secondary'
17
17
  - else
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.35.0'.freeze
2
+ VERSION = '4.35.2'.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: 4.35.0
4
+ version: 4.35.2
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-05-06 00:00:00.000000000 Z
11
+ date: 2025-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails