effective_datatables 4.36.1 → 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 +4 -4
- data/app/helpers/effective_datatables_private_helper.rb +3 -3
- data/app/models/effective/effective_datatable/dsl/datatable.rb +5 -3
- data/app/views/effective/datatables/_resource_column.html.haml +4 -0
- data/config/effective_datatables.rb +4 -0
- data/lib/effective_datatables/version.rb +1 -1
- data/lib/effective_datatables.rb +2 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d505ef855ff08e13f58590a636b1d7c9564e629dc36638e2c440b6935ad62cfa
|
|
4
|
+
data.tar.gz: d87b887564d7b12f1c617b7449cc237baa3623053f41e44da30e2b9e20c53ef1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b231fcc5710c0001d73e7c27a3fe12a5fafaf596aa01b1d0b1beabd3eba096755b9cdf6a99977091c37d3b9bee70e44c3522a431892ed05a75b11888bac29d79
|
|
7
|
+
data.tar.gz: c62e21a13b203cc4397e655dbf8cdfbfcbb004432381c50e8c5008397012c5afb6c3a2990c0d4df92b07a11260de64fc0e140a8d42924c683d69ca62aae73920
|
|
@@ -44,11 +44,11 @@ module EffectiveDatatablesPrivateHelper
|
|
|
44
44
|
def datatable_new_resource_button(datatable, name, column)
|
|
45
45
|
return unless datatable.inline? && (column[:actions][:new] != false)
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
action = { action: :new, class:
|
|
47
|
+
btn_class = EffectiveDatatables.new_action_button_class || 'btn-sm btn-success'
|
|
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
|
-
|
|
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,
|
|
@@ -101,7 +103,7 @@ module Effective
|
|
|
101
103
|
action: false,
|
|
102
104
|
as: :actions,
|
|
103
105
|
compute: nil,
|
|
104
|
-
btn_class: (btn_class || 'btn-sm btn-outline-primary'),
|
|
106
|
+
btn_class: (btn_class || EffectiveDatatables.default_button_class || 'btn-sm btn-outline-primary'),
|
|
105
107
|
col_class: col_class,
|
|
106
108
|
csv: false,
|
|
107
109
|
format: (format if block_given?),
|
|
@@ -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)
|
|
@@ -30,6 +30,10 @@ EffectiveDatatables.setup do |config|
|
|
|
30
30
|
# Default class used on the <table> tag
|
|
31
31
|
config.html_class = 'table table-hover'
|
|
32
32
|
|
|
33
|
+
# These are the button classes
|
|
34
|
+
# config.default_button_class = 'btn-outline-primary' # default class when btn_class option is unspecified
|
|
35
|
+
# config.new_action_button_class = 'btn-success' # overriding class on new action
|
|
36
|
+
|
|
33
37
|
# Log search/sort information to the console
|
|
34
38
|
config.debug = true
|
|
35
39
|
|
data/lib/effective_datatables.rb
CHANGED
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.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-
|
|
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.
|
|
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
|