effective_resources 2.7.15 → 2.7.16
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/controllers/admin/select2_ajax_controller.rb +25 -2
- data/config/routes.rb +1 -0
- data/lib/effective_resources/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: 3812994d8dd5978a7e5b6162cc1fa6f041b1a119a33d0688934d7eb5f73aeb42
|
4
|
+
data.tar.gz: 5f884447a4d2c02318a97cd966ae729613926c123a99282fee92a44a859a653b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47b4d0ff41beeb1743b510cec5e74f209fbe311999931c4381e68d6ef7298f1bd3285224273bbb83deb30880910d9214c5f1c1796a3153d1358a0da0eb2e75c7
|
7
|
+
data.tar.gz: 35dd5881060ea91a9254537aafac5ff3105fd250782f7e2fc009a97957b0158b03edd37bd1e56a53f636d7817493989b40ec474ee71e8b1957595c9e981bbe38
|
@@ -19,10 +19,33 @@ module Admin
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
def organizations
|
23
|
+
raise('the effective memberships gem is required') unless defined?(EffectiveMemberships)
|
24
|
+
|
25
|
+
klass = EffectiveMemberships.Organization
|
26
|
+
raise('an EffectiveMemberships.Organization is required') unless klass.try(:effective_memberships_organization?)
|
27
|
+
|
28
|
+
collection = klass.all
|
29
|
+
|
30
|
+
if collection.respond_to?(:to_select2)
|
31
|
+
collection = collection.to_select2
|
32
|
+
elsif collection.respond_to?(:sorted)
|
33
|
+
collection = collection.sorted
|
34
|
+
end
|
35
|
+
|
36
|
+
respond_with_select2_ajax(collection) do |organization|
|
37
|
+
{ id: organization.to_param, text: organization.try(:to_select2) || to_select2(organization) }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
22
41
|
private
|
23
42
|
|
24
|
-
def to_select2(
|
25
|
-
|
43
|
+
def to_select2(resource)
|
44
|
+
if resource.try(:email).present?
|
45
|
+
"<span>#{resource}</span> <small>#{resource.email}</small>"
|
46
|
+
else
|
47
|
+
"<span>#{resource}</span>"
|
48
|
+
end
|
26
49
|
end
|
27
50
|
|
28
51
|
end
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.16
|
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-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|