effective_datatables 4.17.0 → 4.17.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad7b621e95979cb0e0e41548ef4993a0efd1ca7f1d262656c4a04e611f99fe3d
|
4
|
+
data.tar.gz: 657a4d88aab6e8eff27c86611bff1f35862b69fa30422fe2e29eb3ad0ecb7159
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 033e9e91e76c4682a5dd7bcc02cb68ae4e17558bfe22f665f476ed970b2c75790b9a87e3982b74a254777b9edc6fdfa80e51e88f082c770c76511cbbeecf7800
|
7
|
+
data.tar.gz: 5e3c4745edf257887fa236e0d974985a235599884ce912088140290afcdadcd13cd9ed9846d7bf2f758b4de0546b3d51c885b8aeeeeed90295de2f02ce7cfb3f
|
@@ -69,13 +69,19 @@ module EffectiveDatatablesPrivateHelper
|
|
69
69
|
|
70
70
|
case opts[:as]
|
71
71
|
when :belongs_to
|
72
|
-
opts[:resource].
|
72
|
+
foreign_key = opts[:resource].initialized_name.try(:foreign_key).to_s.downcase
|
73
|
+
klass_name = opts[:resource].initialized_name.try(:class_name).to_s.downcase
|
74
|
+
|
75
|
+
if foreign_key.starts_with?(klass_name)
|
76
|
+
opts[:resource].human_name
|
77
|
+
else
|
78
|
+
datatable.collection_class.human_attribute_name(name)
|
79
|
+
end
|
73
80
|
when :has_many
|
74
81
|
opts[:resource].human_plural_name
|
75
82
|
else
|
76
83
|
datatable.collection_class.human_attribute_name(name)
|
77
84
|
end
|
78
|
-
|
79
85
|
end
|
80
86
|
|
81
87
|
def datatable_search_tag(datatable, name, opts)
|
@@ -178,6 +178,8 @@ module Effective
|
|
178
178
|
search[:collection] = search[:collection].map { |obj| [obj.to_s, obj.id] }
|
179
179
|
elsif search[:collection].kind_of?(Array) && search[:collection].first.kind_of?(ActiveRecord::Base)
|
180
180
|
search[:collection] = search[:collection].map { |obj| [obj.to_s, obj.id] }
|
181
|
+
elsif search[:collection].kind_of?(Array)
|
182
|
+
search[:collection] = search[:collection]
|
181
183
|
end
|
182
184
|
|
183
185
|
search[:as] ||= :select if search.key?(:collection)
|
@@ -189,6 +191,8 @@ module Effective
|
|
189
191
|
|
190
192
|
if array_collection? && opts[:resource].present?
|
191
193
|
search.reverse_merge!(search_resource.search_form_field(name, collection.first[opts[:index]]))
|
194
|
+
elsif search[:as] == :select && search[:collection].kind_of?(Array)
|
195
|
+
# Nothing to do
|
192
196
|
elsif search[:as] != :string
|
193
197
|
search.reverse_merge!(search_resource.search_form_field(name, opts[:as]))
|
194
198
|
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.17.
|
4
|
+
version: 4.17.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: 2023-
|
11
|
+
date: 2023-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|