effective_datatables 4.37.0 → 4.37.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
  SHA256:
3
- metadata.gz: 65762c9c87f1788ec63c7416237b71bccd9b6ed3f5c17f2a13e0f03a42278867
4
- data.tar.gz: 6eef5d9930eb3d153f2eff69fbe8fecd3068543cd3fa32053a3b9054d65fca12
3
+ metadata.gz: d505ef855ff08e13f58590a636b1d7c9564e629dc36638e2c440b6935ad62cfa
4
+ data.tar.gz: d87b887564d7b12f1c617b7449cc237baa3623053f41e44da30e2b9e20c53ef1
5
5
  SHA512:
6
- metadata.gz: 987b5ae60d844786ed4d0a7040035921d30251fc8e7d4312c25c69c6ae6d69ff4516c37b1ed486ce5ff7d25b36e0528605c5209af719e0313633d62ed56c6962
7
- data.tar.gz: 585a6c409ca5c76959fde7038332f638915a7b1713b3669dee51b86fe0c9a939db7a1961f28d8d49125801e5942dd5c0bed65ce3876f4a7aa01ad88fed5c446d
6
+ metadata.gz: b231fcc5710c0001d73e7c27a3fe12a5fafaf596aa01b1d0b1beabd3eba096755b9cdf6a99977091c37d3b9bee70e44c3522a431892ed05a75b11888bac29d79
7
+ data.tar.gz: c62e21a13b203cc4397e655dbf8cdfbfcbb004432381c50e8c5008397012c5afb6c3a2990c0d4df92b07a11260de64fc0e140a8d42924c683d69ca62aae73920
@@ -48,7 +48,7 @@ module EffectiveDatatablesPrivateHelper
48
48
  action = { action: :new, class: "btn #{btn_class}", 'data-remote': true }
49
49
 
50
50
  if column[:actions][:new].kind_of?(Hash) # This might be active_record_array_collection?
51
- actions = action.merge(column[:actions][:new])
51
+ action = action.merge(column[:actions][:new])
52
52
 
53
53
  effective_resource = (datatable.effective_resource || datatable.fallback_effective_resource)
54
54
  klass = (column[:actions][:new][:klass] || effective_resource&.klass || datatable.collection_class)
@@ -38,7 +38,7 @@ module Effective
38
38
  # Anything done in the block, is purely a format on the after sorted/ordered value
39
39
  # the original object == the computed value, which is yielded to the format block
40
40
  # You can't do compute with .col
41
- def col(name, action: nil, as: nil, col_class: nil, csv: true, label: nil, partial: nil, partial_as: nil, responsive: 10000, search: {}, sort: true, sql_column: nil, th: nil, th_append: nil, visible: true, &format)
41
+ def col(name, action: nil, as: nil, badge: true, col_class: nil, csv: true, label: nil, partial: nil, partial_as: nil, responsive: 10000, search: {}, sort: true, sql_column: nil, th: nil, th_append: nil, visible: true, &format)
42
42
  raise 'You cannot use partial: ... with the block syntax' if partial && block_given?
43
43
 
44
44
  name = name.to_sym unless name.to_s.include?('.')
@@ -46,6 +46,7 @@ module Effective
46
46
  datatable._columns[name] = Effective::DatatableColumn.new(
47
47
  action: action,
48
48
  as: as,
49
+ badge: badge,
49
50
  compute: nil,
50
51
  col_class: col_class,
51
52
  csv: csv,
@@ -67,7 +68,7 @@ module Effective
67
68
 
68
69
  # A val is a computed value that is then sorted/searched after the block is run
69
70
  # You can have another block by calling .format afterwards to work on the computed value itself
70
- def val(name, action: nil, as: nil, col_class: nil, csv: true, label: nil, partial: nil, partial_as: nil, responsive: 10000, search: {}, sort: true, sql_column: false, th: nil, th_append: nil, visible: true, &compute)
71
+ def val(name, action: nil, as: nil, badge: true, col_class: nil, csv: true, label: nil, partial: nil, partial_as: nil, responsive: 10000, search: {}, sort: true, sql_column: false, th: nil, th_append: nil, visible: true, &compute)
71
72
  raise 'You cannot use partial: ... with the block syntax' if partial && block_given?
72
73
 
73
74
  name = name.to_sym unless name.to_s.include?('.')
@@ -75,6 +76,7 @@ module Effective
75
76
  datatable._columns[name] = Effective::DatatableColumn.new(
76
77
  action: action,
77
78
  as: as,
79
+ badge: badge,
78
80
  compute: (compute if block_given?),
79
81
  col_class: col_class,
80
82
  csv: csv,
@@ -11,3 +11,7 @@
11
11
  = link_to resource_to_s, path, title: resource_to_s
12
12
  - else
13
13
  = resource_to_s.to_s.html_safe
14
+
15
+ -# Automatically badge any acts_as_statused resource. Opt out with col(..., badge: false)
16
+ - if resource.class.try(:acts_as_statused?) && resource.status.present? && (local_assigns[:column].blank? || column[:badge] != false)
17
+ = badge(resource.status)
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.37.0'.freeze
2
+ VERSION = '4.37.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: 4.37.0
4
+ version: 4.37.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: 2026-03-19 00:00:00.000000000 Z
11
+ date: 2026-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  - !ruby/object:Gem::Version
212
212
  version: '0'
213
213
  requirements: []
214
- rubygems_version: 3.5.6
214
+ rubygems_version: 3.5.9
215
215
  signing_key:
216
216
  specification_version: 4
217
217
  summary: Uniquely powerful server-side searching, sorting and filtering of any ActiveRecord