effective_cpd 1.2.2 → 1.2.3
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/models/concerns/effective_cpd_audit.rb +34 -0
- data/app/views/admin/cpd_audits/_form_chat.html.haml +9 -0
- data/app/views/effective/cpd/_dashboard.html.haml +4 -0
- data/app/views/effective/cpd_audit_reviews/_feedback.html.haml +1 -1
- data/app/views/effective/cpd_audit_reviews/_summary.html.haml +1 -1
- data/db/migrate/01_create_effective_cpd.rb.erb +2 -0
- data/lib/effective_cpd/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eed65d1a331a6a09e8f5435d1f200f646680773b271d0000358438c09122d29e
|
4
|
+
data.tar.gz: 117455812ab24c1d74a19ba95ca4eccfebc3d2085094c394b272c47464ca9907
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa0036e716e1c6b8871d4f149eb8e3f5c372d32888e8c4fd21c5bcda4763adb2eb069e4eaa77ff210172d4dcfff3c746fcc86c5e8720f83a133aa238a4481eb7
|
7
|
+
data.tar.gz: baca0a12db533c7f1fc5dbb1ba9f1ae180b44aa18f30aa0bd360cff51898a4d1e24028f5f30a763e1cd01448bcabff2c3a5a533f6410dbfd0b6eece12ab32f40
|
@@ -36,6 +36,10 @@ module EffectiveCpdAudit
|
|
36
36
|
[:opened, :started, :conflicted_resolved, :exemption_denied, :extension_granted, :extension_denied]
|
37
37
|
end
|
38
38
|
|
39
|
+
def chat_permissions
|
40
|
+
['Can send messages until closed', 'Always send messages', 'Never send messages']
|
41
|
+
end
|
42
|
+
|
39
43
|
end
|
40
44
|
|
41
45
|
included do
|
@@ -150,6 +154,9 @@ module EffectiveCpdAudit
|
|
150
154
|
reviewed_at :datetime, permitted: false
|
151
155
|
closed_at :datetime, permitted: false
|
152
156
|
|
157
|
+
# To control permission of sending messages
|
158
|
+
chat_permission :string, permitted: false
|
159
|
+
|
153
160
|
# Acts as tokyyened
|
154
161
|
token :string, permitted: false
|
155
162
|
|
@@ -181,6 +188,7 @@ module EffectiveCpdAudit
|
|
181
188
|
before_validation(if: -> { new_record? }) do
|
182
189
|
self.notification_date ||= Time.zone.now
|
183
190
|
self.due_date ||= deadline_to_submit()
|
191
|
+
self.chat_permission ||= self.class.chat_permissions.first
|
184
192
|
end
|
185
193
|
|
186
194
|
with_options(if: -> { cpd_audit_level&.anonymous? }) do
|
@@ -222,6 +230,12 @@ module EffectiveCpdAudit
|
|
222
230
|
end
|
223
231
|
end
|
224
232
|
|
233
|
+
validate(if: -> { chat_permission.present? }) do
|
234
|
+
unless self.class.chat_permissions.include?(chat_permission)
|
235
|
+
self.errors.add(:chat_permission, 'is invalid')
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
225
239
|
# If we're submitted. Check if we can go into reviewed?
|
226
240
|
before_save(if: -> { submitted? }) { try_complete! }
|
227
241
|
before_save(if: -> { completed? }) { try_review! }
|
@@ -289,6 +303,14 @@ module EffectiveCpdAudit
|
|
289
303
|
chat
|
290
304
|
end
|
291
305
|
|
306
|
+
def chat_url(chat:, user:, root_url:)
|
307
|
+
resource = if user.try(:cpd_audit_reviewer?)
|
308
|
+
cpd_audit_reviews.find { |review| review.user == user } || raise('expected to find existing reviewer')
|
309
|
+
end || self
|
310
|
+
|
311
|
+
[root_url.chomp('/'), resource.class.table_name, resource.to_param, 'chat'].join('/')
|
312
|
+
end
|
313
|
+
|
292
314
|
end
|
293
315
|
|
294
316
|
def to_s
|
@@ -323,6 +345,18 @@ module EffectiveCpdAudit
|
|
323
345
|
was_completed?
|
324
346
|
end
|
325
347
|
|
348
|
+
def chat_until_closed?
|
349
|
+
chat_permission == 'Can send messages until closed'
|
350
|
+
end
|
351
|
+
|
352
|
+
def chat_always?
|
353
|
+
chat_permission == 'Always send messages'
|
354
|
+
end
|
355
|
+
|
356
|
+
def chat_never?
|
357
|
+
chat_permission == 'Never send messages'
|
358
|
+
end
|
359
|
+
|
326
360
|
def status_label
|
327
361
|
(status_was || status).to_s.gsub('_', ' ')
|
328
362
|
end
|
@@ -1,3 +1,12 @@
|
|
1
|
+
= card('Chat Permission') do
|
2
|
+
= effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
|
3
|
+
%p By default, auditees and reviewers can send messages until the audit is closed.
|
4
|
+
|
5
|
+
.row
|
6
|
+
.col-sm-6
|
7
|
+
= f.select :chat_permission, cpd_audit.class.chat_permissions, label: false
|
8
|
+
= f.submit 'Save', center: true, border: false
|
9
|
+
|
1
10
|
- if cpd_audit.chat.present?
|
2
11
|
= render('effective/chats/chat', chat: cpd_audit.chat)
|
3
12
|
- else
|
@@ -40,6 +40,10 @@
|
|
40
40
|
%p You have completed these past statements:
|
41
41
|
= render_datatable(completed, simple: true)
|
42
42
|
|
43
|
+
- unless current_user.try(:cpd_audit_reviewer?)
|
44
|
+
- if auditing.blank? && audited.blank? && available.blank? && completed.blank?
|
45
|
+
%p There are no activities available right now. When there are, we'll show them here.
|
46
|
+
|
43
47
|
- if current_user.try(:cpd_audit_reviewer?)
|
44
48
|
- # Auditor / Audit reviewer datatables (2)
|
45
49
|
- reviewing = EffectiveCpdAvailableAuditReviewsDatatable.new(self)
|