kadmin 0.8.0 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/kadmin/concerns/resources.rb +17 -8
- data/lib/kadmin/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe93b6bebb3211e1154d0740928d46babcea9a5b8274d5143bc1d05045258582
|
4
|
+
data.tar.gz: ebc7620ec9474cd3f90d527847385b799293982d4a2744607d9b1ad1e7c5259e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdd30f1c442519fcd778cfa3a8068e80372e8ade3e7e11d5fa3ce43ed72e53743c2e8f895cb1b126a6d7dd1265ab1dd04a543a14e1671a89b3191370e91aaa26
|
7
|
+
data.tar.gz: 7d30719111ee40319e908c70d3f8204830babcc98c9a31989a4bed0b37c96e3d1ef8742488c41bb1ab3950007a1109f6cbf017f79ff955c216e5548289954587
|
@@ -37,18 +37,27 @@ module Kadmin
|
|
37
37
|
|
38
38
|
private
|
39
39
|
|
40
|
-
#
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
40
|
+
# Takes in a column or array of column names, and returns a proc
|
41
|
+
# ready to be used by this class.
|
42
|
+
# Columns can contain either symbols, strings, or directly an Arel::Node,
|
43
|
+
# allowing you to reference joined tables as well.
|
44
|
+
def resources_filter_matches(columns)
|
45
|
+
return lambda do |v|
|
46
|
+
pattern = "%#{v}%"
|
47
|
+
conditions = Array.wrap(columns).reduce(nil) do |acc, column|
|
48
|
+
column = arel_table[column] unless column.is_a?(Arel::Attributes::Attribute)
|
49
|
+
matcher = column.matches(pattern)
|
50
|
+
acc.nil? ? matcher : acc.or(matcher)
|
46
51
|
end
|
47
52
|
|
48
|
-
|
53
|
+
where(conditions)
|
49
54
|
end
|
55
|
+
end
|
50
56
|
|
51
|
-
|
57
|
+
# DEPRECATED
|
58
|
+
def resources_deprecated_parse_filter(hash)
|
59
|
+
filter_scope = resources_filter_matches(hash[:column])
|
60
|
+
Finder::Filter.new(hash[:name], filter_scope)
|
52
61
|
end
|
53
62
|
end
|
54
63
|
end
|
data/lib/kadmin/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kadmin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas Pepin-Perreault
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-04-
|
13
|
+
date: 2018-04-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|