effective_cpd 0.3.1 → 0.4.0

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: 86cc744bca079efc7c8980e61f35d8200c4b01efbc309481ad50bf9ffa8d885c
4
- data.tar.gz: bd79c194bc5b49fa01777fd43e7cd6a9efd029b17ca70793ce54059a26656ac1
3
+ metadata.gz: f290e98f25e51c9ebc4497830cd628ac7921a01c2a2be09b1a335af28bc6c003
4
+ data.tar.gz: fe7d20bb2bbdada0b0a30f53801ad877f51e5a01d8d56d3af4b225c820ec402e
5
5
  SHA512:
6
- metadata.gz: b014a09d8642a8e61c82887ffd511883203b2c5bc06db5eaefd60765c17b2275b944e1d591dce8d0db2197c568f7f9ee4f276bcc7f175c99a0ced075542b07d7
7
- data.tar.gz: bfd0c5a9a54df1b62de4c9345da508a9126ca2271480677bb8304b32b5d79085eca22a0c0502d8d56e496b7c88b845c00b59f287a378a2940c1208a1cc6cdc05
6
+ metadata.gz: b7bbf3b41e25cdd4b5ebe86d0f186c531450e614ef454367a08623f6868aa93e9ba5e37f35e7ad7f867a04e04f6a8c458acec9dd69cf2e98aca6329a1d21580e
7
+ data.tar.gz: 4050c510065598ca04809542bd50a16e54e93c9284610dc610693a06212cd9c897ef40e39508cc5f14e0d2f2e1239492bb42deb71fe257a3a51aadd8a7276843
@@ -2,8 +2,8 @@ module Admin
2
2
  class EffectiveCpdAuditReviewsDatatable < Effective::Datatable
3
3
  filters do
4
4
  scope :all
5
- scope :available, label: 'In Progress'
6
5
  scope :completed
6
+ scope :available, label: 'In Progress'
7
7
  end
8
8
 
9
9
  datatable do
@@ -12,7 +12,14 @@ module Admin
12
12
  col :id, visible: false
13
13
 
14
14
  col :cpd_audit
15
+
16
+ col :auditee do |cpd_audit_review|
17
+ user = cpd_audit_review.cpd_audit.user
18
+ link_to(user, edit_admin_user_path(user))
19
+ end
20
+
15
21
  col :user, label: 'Audit Reviewer'
22
+
16
23
  col :due_date
17
24
  col :submitted_at, as: :date, label: 'Submitted'
18
25
  col :conflict_of_interest
@@ -47,6 +47,29 @@ module Admin
47
47
  col :due_date
48
48
 
49
49
  col :status
50
+
51
+ col(:cpd_audit_recommendations, label: 'Recommendation', visible: false) do |cpd_audit|
52
+ cpd_audit.cpd_audit_reviews.map(&:recommendation).map do |recommendation|
53
+ content_tag(:div, recommendation.to_s, class: 'col-resource_item')
54
+ end.join.html_safe
55
+ end
56
+
57
+ col(:cpd_audit_reveiw_item_recommendations, label: 'Item Recommendations', search: :string, visible: false) do |cpd_audit|
58
+ recommendations = cpd_audit.cpd_audit_reviews.map(&:recommendation)
59
+ item_recommendations = cpd_audit.cpd_audit_reviews.flat_map { |r| r.cpd_audit_review_items.map(&:recommendation) }
60
+
61
+ reviews = ((recommendations + item_recommendations) - ['', nil]).uniq
62
+ reviews.to_sentence
63
+ end
64
+
65
+ col(:cpd_audit_comments, label: 'Reviewer Comments', search: :string, visible: false) do |cpd_audit|
66
+ item_comments = cpd_audit.cpd_audit_reviews.flat_map { |r| r.cpd_audit_review_items.map(&:comments) }.join
67
+
68
+ cpd_audit.cpd_audit_reviews.map(&:comments).map do |comments|
69
+ content_tag(:div, simple_format(comments.to_s + item_comments), class: 'col-resource_item')
70
+ end.join.html_safe
71
+ end
72
+
50
73
  col :determination
51
74
 
52
75
  col(:auditee_cpd_statements, label: 'Auditee Statements', visible: false) do |cpd_audit|
@@ -76,6 +76,9 @@ module Effective
76
76
  # Final determination
77
77
  determination :string
78
78
 
79
+ # Override Deadlines
80
+ ignore_deadlines :boolean
81
+
79
82
  # Auditee response
80
83
  conflict_of_interest :boolean
81
84
  conflict_of_interest_reason :text
@@ -130,17 +133,17 @@ module Effective
130
133
  validates :extension_request_date, presence: true, if: -> { extension_request? }
131
134
  validates :extension_request_reason, presence: true, if: -> { extension_request? }
132
135
 
133
- validate(if: -> { current_step == :conflict && conflict_of_interest? }) do
136
+ validate(if: -> { current_step == :conflict && conflict_of_interest? && !ignore_deadlines? }) do
134
137
  deadline = deadline_to_conflict_of_interest()
135
138
  self.errors.add(:base, 'deadline to declare conflict of interest has already passed') if deadline && deadline < Time.zone.now
136
139
  end
137
140
 
138
- validate(if: -> { current_step == :exemption && exemption_request? }) do
141
+ validate(if: -> { current_step == :exemption && exemption_request? && !ignore_deadlines? }) do
139
142
  deadline = deadline_to_exemption()
140
143
  self.errors.add(:base, 'deadline to request exemption has already passed') if deadline && deadline < Time.zone.now
141
144
  end
142
145
 
143
- validate(if: -> { current_step == :extension && extension_request? }) do
146
+ validate(if: -> { current_step == :extension && extension_request? && !ignore_deadlines? }) do
144
147
  deadline = deadline_to_extension()
145
148
  self.errors.add(:base, 'deadline to request extension has already passed') if deadline && deadline < Time.zone.now
146
149
  end
@@ -7,7 +7,12 @@
7
7
  .row
8
8
  .col
9
9
  = f.text_field :title, label: 'Title'
10
- = f.rich_text_area :body, label: 'Body (optional)'
10
+
11
+ - if defined?(EffectiveArticleEditor)
12
+ = f.article_editor :body, label: 'Body (optional)'
13
+ - else
14
+ = f.rich_text_area :body, label: 'Body (optional)'
15
+
11
16
  .col
12
17
  = f.text_field :amount_label,
13
18
  hint: 'hours of work, papers written, courses attended'
@@ -5,7 +5,11 @@
5
5
  = f.select :cpd_audit_level_section_id, Effective::CpdAuditLevelSection.sorted.all
6
6
 
7
7
  = f.text_field :title, label: 'Question Title'
8
- = f.rich_text_area :body, label: 'Body (optional)'
8
+
9
+ - if defined?(EffectiveArticleEditor)
10
+ = f.article_editor :body, label: 'Body (optional)'
11
+ - else
12
+ = f.rich_text_area :body, label: 'Body (optional)'
9
13
 
10
14
  = f.check_box :required, hint: 'A response to this question will be required'
11
15
  = f.select :category, Effective::CpdAuditLevelQuestion::CATEGORIES
@@ -2,14 +2,18 @@
2
2
 
3
3
  = effective_form_with(model: [:admin, cpd_audit_level], engine: true) do |f|
4
4
  = card("All Steps Content") do
5
- = f.rich_text_area "rich_text_all_steps_audit_content", label: false,
6
- hint: "displayed on all steps"
5
+ - if defined?(EffectiveArticleEditor)
6
+ = f.article_editor "rich_text_all_steps_audit_content", label: false, hint: "displayed on all steps"
7
+ - else
8
+ = f.rich_text_area "rich_text_all_steps_audit_content", label: false, hint: "displayed on all steps"
7
9
 
8
10
  %hr
9
11
 
10
12
  - Effective::CpdAudit::WIZARD_STEPS.each do |step, title|
11
13
  = card("#{title} Content") do
12
- = f.rich_text_area "rich_text_#{step}_audit_content", label: false,
13
- hint: "displayed on the auditee wizard #{step} wizard step only"
14
+ - if defined?(EffectiveArticleEditor)
15
+ = f.article_editor "rich_text_#{step}_audit_content", label: false, hint: "displayed on the auditee wizard #{step} wizard step only"
16
+ - else
17
+ = f.rich_text_area "rich_text_#{step}_audit_content", label: false, hint: "displayed on the auditee wizard #{step} wizard step only"
14
18
 
15
19
  = f.submit
@@ -2,14 +2,18 @@
2
2
 
3
3
  = effective_form_with(model: [:admin, cpd_audit_level], engine: true) do |f|
4
4
  = card("All Steps Content") do
5
- = f.rich_text_area "rich_text_all_steps_audit_review_content", label: false,
6
- hint: "displayed on all steps"
5
+ - if defined?(EffectiveArticleEditor)
6
+ = f.article_editor "rich_text_all_steps_audit_review_content", label: false, hint: "displayed on all steps"
7
+ - else
8
+ = f.rich_text_area "rich_text_all_steps_audit_review_content", label: false, hint: "displayed on all steps"
7
9
 
8
10
  %hr
9
11
 
10
12
  - Effective::CpdAuditReview::WIZARD_STEPS.each do |step, title|
11
13
  = card("#{title} Content") do
12
- = f.rich_text_area "rich_text_#{step}_audit_review_content", label: false,
13
- hint: "displayed on the audit reviewer #{step} wizard step only"
14
+ - if defined?(EffectiveArticleEditor)
15
+ = f.article_editor "rich_text_#{step}_audit_review_content", label: false, hint: "displayed on the audit reviewer #{step} wizard step only"
16
+ - else
17
+ = f.rich_text_area "rich_text_#{step}_audit_review_content", label: false, hint: "displayed on the audit reviewer #{step} wizard step only"
14
18
 
15
19
  = f.submit
@@ -17,6 +17,9 @@
17
17
  = tab 'Audit' do
18
18
  = render 'effective/cpd_audits/cpd_audit', cpd_audit: cpd_audit
19
19
 
20
+ = tab 'Deadlines' do
21
+ = render 'admin/cpd_audits/form_deadlines', cpd_audit: cpd_audit
22
+
20
23
  = tab 'Statements' do
21
24
  - datatable = Admin::EffectiveCpdStatementsDatatable.new(user_id: cpd_audit.user.id, user_type: cpd_audit.user.class.name)
22
25
  = render_datatable(datatable, inline: true, simple: true)
@@ -0,0 +1,12 @@
1
+ = card('Deadlines') do
2
+ = effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
3
+ %p The audittee has the following deadlines:
4
+
5
+ %ul
6
+ %li To declare conflict of interest: #{f.object.deadline_to_conflict_of_interest}
7
+ %li To request exemption: #{f.object.deadline_to_exemption}
8
+ %li To request extension: #{f.object.deadline_to_extension}
9
+
10
+ = f.check_box :ignore_deadlines, label: 'Yes, ignore audittee deadlines and allow these actions to be performed'
11
+
12
+ = f.submit 'Save', center: true
@@ -1,5 +1,9 @@
1
1
  = effective_form_with(model: [:admin, cpd_category], engine: true) do |f|
2
2
  = f.text_field :title
3
- = f.rich_text_area :body
3
+
4
+ - if defined?(EffectiveArticleEditor)
5
+ = f.article_editor :body
6
+ - else
7
+ = f.rich_text_area :body
4
8
 
5
9
  = effective_submit(f)
@@ -4,37 +4,58 @@
4
4
  .card.mb-4
5
5
  .card-body
6
6
  %h5.card-title All Steps Content
7
- = f.rich_text_area :all_steps_content, label: false, hint: 'displayed on all statement steps'
7
+ - if defined?(EffectiveArticleEditor)
8
+ = f.article_editor :all_steps_content, label: false, hint: 'displayed on all statement steps'
9
+ - else
10
+ = f.rich_text_area :all_steps_content, label: false, hint: 'displayed on all statement steps'
8
11
 
9
12
  .card.mb-4
10
13
  .card-body
11
14
  %h5.card-title Sidebar Content
12
- = f.rich_text_area :sidebar_content, label: false, hint: 'displayed on the sidebar on all statement steps'
15
+ - if defined?(EffectiveArticleEditor)
16
+ = f.article_editor :sidebar_content, label: false, hint: 'displayed on the sidebar on all statement steps'
17
+ - else
18
+ = f.rich_text_area :sidebar_content, label: false, hint: 'displayed on the sidebar on all statement steps'
13
19
 
14
20
  %h2 Individual Steps Content
15
21
  .card.mb-4
16
22
  .card-body
17
23
  %h5.card-title Start Step
18
- = f.rich_text_area :start_content, label: false, hint: 'displayed on the start step only'
24
+ - if defined?(EffectiveArticleEditor)
25
+ = f.article_editor :start_content, label: false, hint: 'displayed on the start step only'
26
+ - else
27
+ = f.rich_text_area :start_content, label: false, hint: 'displayed on the start step only'
19
28
 
20
29
  .card.mb-4
21
30
  .card-body
22
31
  %h5.card-title Activities Step
23
- = f.rich_text_area :activities_content, label: false, hint: 'displayed on the activities step only'
32
+ - if defined?(EffectiveArticleEditor)
33
+ = f.article_editor :activities_content, label: false, hint: 'displayed on the activities step only'
34
+ - else
35
+ = f.rich_text_area :activities_content, label: false, hint: 'displayed on the activities step only'
24
36
 
25
37
  .card.mb-4
26
38
  .card-body
27
39
  %h5.card-title Agreements Step
28
- = f.rich_text_area :agreements_content, label: false, hint: 'displayed on the agreements step only'
40
+ - if defined?(EffectiveArticleEditor)
41
+ = f.article_editor :agreements_content, label: false, hint: 'displayed on the agreements step only'
42
+ - else
43
+ = f.rich_text_area :agreements_content, label: false, hint: 'displayed on the agreements step only'
29
44
 
30
45
  .card.mb-4
31
46
  .card-body
32
47
  %h5.card-title Submit Step
33
- = f.rich_text_area :submit_content, label: false, hint: 'displayed on the submit step only'
48
+ - if defined?(EffectiveArticleEditor)
49
+ = f.article_editor :submit_content, label: false, hint: 'displayed on the submit step only'
50
+ - else
51
+ = f.rich_text_area :submit_content, label: false, hint: 'displayed on the submit step only'
34
52
 
35
53
  .card.mb-4
36
54
  .card-body
37
55
  %h5.card-title Complete Step
38
- = f.rich_text_area :complete_content, label: false, hint: 'displayed on the complete step only'
56
+ - if defined?(EffectiveArticleEditor)
57
+ = f.article_editor :complete_content, label: false, hint: 'displayed on the complete step only'
58
+ - else
59
+ = f.rich_text_area :complete_content, label: false, hint: 'displayed on the complete step only'
39
60
 
40
61
  = f.submit
@@ -5,7 +5,7 @@
5
5
  - resource.cpd_audit_reviews.each do |cpd_audit_review|
6
6
  %li #{cpd_audit_review.user} <#{mail_to(cpd_audit_review.user.email)}>
7
7
 
8
- - if resource.deadline_to_conflict_of_interest.present?
8
+ - if resource.deadline_to_conflict_of_interest.present? && !resource.ignore_deadlines?
9
9
  %p The deadline to declare a conflict of interest is: #{resource.deadline_to_conflict_of_interest.strftime('%F')}.
10
10
 
11
11
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
@@ -2,7 +2,7 @@
2
2
  - if resource.was_exemption_requested?
3
3
  = render('effective/cpd_audits/exemption', cpd_audit: resource, step: :exemption)
4
4
 
5
- - if resource.deadline_to_exemption.present?
5
+ - if resource.deadline_to_exemption.present? && !resource.ignore_deadlines?
6
6
  %p The deadline to request an exemption is: #{resource.deadline_to_exemption.strftime('%F')}.
7
7
 
8
8
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
@@ -2,7 +2,7 @@
2
2
  - if resource.was_extension_requested?
3
3
  = render('effective/cpd_audits/extension', cpd_audit: resource, step: :extension)
4
4
 
5
- - if resource.deadline_to_extension.present?
5
+ - if resource.deadline_to_extension.present? && !resource.ignore_deadlines?
6
6
  %p The deadline to request an extension is: #{resource.deadline_to_extension.strftime('%F')}.
7
7
 
8
8
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
@@ -176,6 +176,8 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
176
176
  t.date :notification_date
177
177
  t.date :extension_date
178
178
 
179
+ t.boolean :ignore_deadlines, default: false
180
+
179
181
  t.string :determination
180
182
 
181
183
  t.boolean :conflict_of_interest
@@ -1,3 +1,3 @@
1
1
  module EffectiveCpd
2
- VERSION = '0.3.1'
2
+ VERSION = '0.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_cpd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
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: 2022-03-07 00:00:00.000000000 Z
11
+ date: 2022-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -246,6 +246,7 @@ files:
246
246
  - app/views/admin/cpd_audits/_auditee_fields.html.haml
247
247
  - app/views/admin/cpd_audits/_form.html.haml
248
248
  - app/views/admin/cpd_audits/_form_conflict.html.haml
249
+ - app/views/admin/cpd_audits/_form_deadlines.html.haml
249
250
  - app/views/admin/cpd_audits/_form_determination.html.haml
250
251
  - app/views/admin/cpd_audits/_form_exemption.html.haml
251
252
  - app/views/admin/cpd_audits/_form_extension.html.haml