effective_polls 0.5.1 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/effective_polls_user.rb +26 -6
- data/lib/effective_polls/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: aeea63d1d031f9751443c64f3113cf04f92cb564df3b5e2a96d67f28fbc921b6
|
4
|
+
data.tar.gz: f86d75f535b04ccbe7aba717a28a30f6f2e2c984b12217d17d5835a51f74c55c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac6766f7c1c99724ab5b531e6fc114eac48f5489d8e2864e59b96c3e36b8950cc9c47d8fd3b661490a790b8183c36bacee6a8ea7890128c8de7586917f165e3d
|
7
|
+
data.tar.gz: 917faf44d9918eb10b2dacff690d3fb624c2e150aead4a32d20dfc4a3c677c092277d34a7635da2c1df952f2344af7148c4e2e179a0bbf5fe58e17358f617802
|
@@ -21,6 +21,9 @@ module EffectivePollsUser
|
|
21
21
|
|
22
22
|
# The list of all available audience scopes for the Poll Selected Users
|
23
23
|
def poll_audience_scopes
|
24
|
+
end
|
25
|
+
|
26
|
+
def default_poll_audience_scopes
|
24
27
|
scopes = [
|
25
28
|
['All Users', :all]
|
26
29
|
]
|
@@ -39,6 +42,18 @@ module EffectivePollsUser
|
|
39
42
|
end
|
40
43
|
end
|
41
44
|
|
45
|
+
if self.class.try(:effective_committees_user?)
|
46
|
+
scopes += Effective::Committee.sorted.map do |committee|
|
47
|
+
["All #{committee} committee members", "with_committee_id_#{committee.id}"]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
if self.class.try(:acts_as_role_restricted?)
|
52
|
+
scopes += EffectiveRoles.roles.map do |role|
|
53
|
+
["All #{role} role users", "with_role_id_#{role}"]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
42
57
|
scopes
|
43
58
|
end
|
44
59
|
|
@@ -46,18 +61,23 @@ module EffectivePollsUser
|
|
46
61
|
def poll_audience_scope(value)
|
47
62
|
collection = self.class.respond_to?(:unarchived) ? self.class.unarchived : self.class
|
48
63
|
|
49
|
-
# If we respond to the fill value, call it
|
50
|
-
return collection.send(value) if collection.respond_to?(value)
|
51
|
-
|
52
64
|
# Parse the value
|
53
65
|
name, id = value.to_s.split('_id_')
|
54
66
|
|
55
67
|
case name.try(:to_sym)
|
56
68
|
when :members_with_category
|
57
|
-
collection.members_with_category(EffectiveMemberships.Category.
|
58
|
-
|
59
|
-
|
69
|
+
return collection.members_with_category(EffectiveMemberships.Category.find_by_id(id))
|
70
|
+
when :with_committee
|
71
|
+
return collection.with_committee(Effective::Committee.find_by_id(id))
|
72
|
+
when :with_role
|
73
|
+
return collection.with_role(id)
|
60
74
|
end
|
75
|
+
|
76
|
+
# Otherwise we don't know what this scope is
|
77
|
+
raise("unknown poll_audience_scope for #{value}. Expected #{self.class.name} to have a scope named #{value}") unless collection.respond_to?(value)
|
78
|
+
|
79
|
+
# If we respond to the fill value, call it
|
80
|
+
collection.send(value)
|
61
81
|
end
|
62
82
|
|
63
83
|
def available_polls
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_polls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
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-10
|
11
|
+
date: 2023-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|