effective_cpd 0.0.1 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +122 -10
- data/app/assets/javascripts/effective_cpd/activities.js +6 -0
- data/app/controllers/admin/cpd_audit_level_questions_controller.rb +13 -0
- data/app/controllers/admin/cpd_audit_levels_controller.rb +13 -0
- data/app/controllers/admin/cpd_audit_reviews_controller.rb +13 -0
- data/app/controllers/admin/cpd_audits_controller.rb +41 -0
- data/app/controllers/admin/cpd_special_rules_controller.rb +13 -0
- data/app/controllers/effective/cpd_audit_reviews_controller.rb +60 -0
- data/app/controllers/effective/cpd_audits_controller.rb +55 -0
- data/app/controllers/effective/cpd_cycles_controller.rb +1 -0
- data/app/controllers/effective/cpd_statements_controller.rb +1 -3
- data/app/datatables/admin/effective_cpd_audit_level_questions_datatable.rb +30 -0
- data/app/datatables/admin/effective_cpd_audit_levels_datatable.rb +34 -0
- data/app/datatables/admin/effective_cpd_audit_reviews_datatable.rb +29 -0
- data/app/datatables/admin/effective_cpd_audits_datatable.rb +67 -0
- data/app/datatables/admin/effective_cpd_special_rules_datatable.rb +23 -0
- data/app/datatables/admin/effective_cpd_statements_datatable.rb +3 -3
- data/app/datatables/effective_cpd_available_audit_reviews_datatable.rb +37 -0
- data/app/datatables/effective_cpd_available_audits_datatable.rb +30 -0
- data/app/datatables/{effective_cpd_datatable.rb → effective_cpd_available_cycles_datatable.rb} +3 -4
- data/app/datatables/effective_cpd_completed_audit_reviews_datatable.rb +32 -0
- data/app/datatables/effective_cpd_completed_audits_datatable.rb +24 -0
- data/app/datatables/effective_cpd_completed_statements_datatable.rb +28 -0
- data/app/helpers/effective_cpd_audits_helper.rb +48 -0
- data/app/helpers/effective_cpd_helper.rb +10 -0
- data/app/mailers/effective/cpd_mailer.rb +155 -3
- data/app/models/concerns/effective_cpd_user.rb +29 -0
- data/app/models/effective/cpd_activity.rb +16 -3
- data/app/models/effective/cpd_audit.rb +380 -0
- data/app/models/effective/cpd_audit_level.rb +87 -0
- data/app/models/effective/cpd_audit_level_question.rb +91 -0
- data/app/models/effective/cpd_audit_level_question_option.rb +34 -0
- data/app/models/effective/cpd_audit_level_section.rb +50 -0
- data/app/models/effective/cpd_audit_response.rb +86 -0
- data/app/models/effective/cpd_audit_response_option.rb +6 -0
- data/app/models/effective/cpd_audit_review.rb +222 -0
- data/app/models/effective/cpd_audit_review_item.rb +34 -0
- data/app/models/effective/cpd_category.rb +12 -3
- data/app/models/effective/cpd_cycle.rb +18 -2
- data/app/models/effective/cpd_rule.rb +23 -6
- data/app/models/effective/cpd_scorer.rb +23 -1
- data/app/models/effective/cpd_special_rule.rb +54 -0
- data/app/models/effective/cpd_special_rule_mate.rb +6 -0
- data/app/models/effective/cpd_statement.rb +25 -11
- data/app/views/admin/cpd_activities/_form.html.haml +1 -1
- data/app/views/admin/cpd_audit_level_questions/_form.html.haml +100 -0
- data/app/views/admin/cpd_audit_levels/_form.html.haml +24 -0
- data/app/views/admin/cpd_audit_levels/_form_content_audit.html.haml +15 -0
- data/app/views/admin/cpd_audit_levels/_form_content_audit_review.html.haml +15 -0
- data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level.html.haml +52 -0
- data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level_section.html.haml +10 -0
- data/app/views/admin/cpd_audit_reviews/_cpd_audit_review.html.haml +1 -0
- data/app/views/admin/cpd_audit_reviews/_form.html.haml +13 -0
- data/app/views/admin/cpd_audits/_audit_reviewer_fields.html.haml +2 -0
- data/app/views/admin/cpd_audits/_auditee_fields.html.haml +2 -0
- data/app/views/admin/cpd_audits/_form.html.haml +46 -0
- data/app/views/admin/cpd_audits/_form_conflict.html.haml +24 -0
- data/app/views/admin/cpd_audits/_form_determination.html.haml +10 -0
- data/app/views/admin/cpd_audits/_form_exemption.html.haml +24 -0
- data/app/views/admin/cpd_audits/_form_extension.html.haml +24 -0
- data/app/views/admin/cpd_audits/_form_new.html.haml +28 -0
- data/app/views/admin/cpd_audits/_status.html.haml +121 -0
- data/app/views/admin/cpd_categories/_form.html.haml +1 -1
- data/app/views/admin/cpd_cycles/_form.html.haml +6 -3
- data/app/views/admin/cpd_cycles/_form_content.html.haml +8 -0
- data/app/views/admin/cpd_cycles/_form_cpd_cycle.html.haml +3 -0
- data/app/views/admin/cpd_cycles/_form_cpd_rules.html.haml +12 -7
- data/app/views/admin/cpd_cycles/_form_cpd_special_rules.html.haml +4 -0
- data/app/views/admin/cpd_special_rules/_form.html.haml +18 -0
- data/app/views/admin/cpd_statements/_cpd_statement.html.haml +7 -0
- data/app/views/effective/cpd_audit_level_questions/_cpd_audit_level_question.html.haml +5 -0
- data/app/views/effective/cpd_audit_responses/_cpd_audit_response.html.haml +4 -0
- data/app/views/effective/cpd_audit_responses/_fields.html.haml +13 -0
- data/app/views/effective/cpd_audit_responses/fields/_choose_one.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_date.html.haml +2 -0
- data/app/views/effective/cpd_audit_responses/fields/_email.html.haml +2 -0
- data/app/views/effective/cpd_audit_responses/fields/_long_answer.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_number.html.haml +2 -0
- data/app/views/effective/cpd_audit_responses/fields/_select_all_that_apply.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_select_up_to_1.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_select_up_to_2.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_select_up_to_3.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_select_up_to_4.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_select_up_to_5.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_short_answer.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_upload_file.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/responses/_choose_one.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/responses/_date.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/responses/_email.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/responses/_long_answer.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/responses/_number.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/responses/_select_all_that_apply.html.haml +5 -0
- data/app/views/effective/cpd_audit_responses/responses/_select_up_to_1.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/responses/_select_up_to_2.html.haml +5 -0
- data/app/views/effective/cpd_audit_responses/responses/_select_up_to_3.html.haml +5 -0
- data/app/views/effective/cpd_audit_responses/responses/_select_up_to_4.html.haml +5 -0
- data/app/views/effective/cpd_audit_responses/responses/_select_up_to_5.html.haml +5 -0
- data/app/views/effective/cpd_audit_responses/responses/_short_answer.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/responses/_upload_file.html.haml +4 -0
- data/app/views/effective/cpd_audit_review_items/_cpd_audit_review_item.html.haml +6 -0
- data/app/views/effective/cpd_audit_review_items/_fields.html.haml +11 -0
- data/app/views/effective/cpd_audit_reviews/_conflict.html.haml +15 -0
- data/app/views/effective/cpd_audit_reviews/_cpd_audit_level_section.html.haml +23 -0
- data/app/views/effective/cpd_audit_reviews/_cpd_audit_review.html.haml +17 -0
- data/app/views/effective/cpd_audit_reviews/_cpd_statement.html.haml +15 -0
- data/app/views/effective/cpd_audit_reviews/_layout.html.haml +24 -0
- data/app/views/effective/cpd_audit_reviews/_recommendation.html.haml +9 -0
- data/app/views/effective/cpd_audit_reviews/_summary.html.haml +47 -0
- data/app/views/effective/cpd_audit_reviews/complete.html.haml +20 -0
- data/app/views/effective/cpd_audit_reviews/conflict.html.haml +21 -0
- data/app/views/effective/cpd_audit_reviews/cpd_audit_level_section.html.haml +43 -0
- data/app/views/effective/cpd_audit_reviews/cpd_statement.html.haml +35 -0
- data/app/views/effective/cpd_audit_reviews/information.html.haml +5 -0
- data/app/views/effective/cpd_audit_reviews/instructions.html.haml +10 -0
- data/app/views/effective/cpd_audit_reviews/questionnaire.html.haml +8 -0
- data/app/views/effective/cpd_audit_reviews/recommendation.html.haml +21 -0
- data/app/views/effective/cpd_audit_reviews/start.html.haml +10 -0
- data/app/views/effective/cpd_audit_reviews/statements.html.haml +29 -0
- data/app/views/effective/cpd_audit_reviews/submit.html.haml +14 -0
- data/app/views/effective/cpd_audit_reviews/waiting.html.haml +9 -0
- data/app/views/effective/cpd_audits/_conflict.html.haml +15 -0
- data/app/views/effective/cpd_audits/_cpd_audit.html.haml +12 -0
- data/app/views/effective/cpd_audits/_cpd_audit_level_section.html.haml +14 -0
- data/app/views/effective/cpd_audits/_exemption.html.haml +26 -0
- data/app/views/effective/cpd_audits/_extension.html.haml +30 -0
- data/app/views/effective/cpd_audits/_files.html.haml +12 -0
- data/app/views/effective/cpd_audits/_layout.html.haml +33 -0
- data/app/views/effective/cpd_audits/_summary.html.haml +54 -0
- data/app/views/effective/cpd_audits/_waiting.html.haml +6 -0
- data/app/views/effective/cpd_audits/complete.html.haml +24 -0
- data/app/views/effective/cpd_audits/conflict.html.haml +22 -0
- data/app/views/effective/cpd_audits/cpd_audit_level_section.html.haml +20 -0
- data/app/views/effective/cpd_audits/exemption.html.haml +19 -0
- data/app/views/effective/cpd_audits/extension.html.haml +21 -0
- data/app/views/effective/cpd_audits/files.html.haml +7 -0
- data/app/views/effective/cpd_audits/information.html.haml +5 -0
- data/app/views/effective/cpd_audits/instructions.html.haml +5 -0
- data/app/views/effective/cpd_audits/questionnaire.html.haml +5 -0
- data/app/views/effective/cpd_audits/start.html.haml +11 -0
- data/app/views/effective/cpd_audits/submit.html.haml +15 -0
- data/app/views/effective/cpd_audits/waiting.html.haml +24 -0
- data/app/views/effective/cpd_mailer/README.md +1 -0
- data/app/views/effective/cpd_mailer/cpd_audit_closed.liquid +15 -0
- data/app/views/effective/cpd_mailer/cpd_audit_conflict_resolved.liquid +15 -0
- data/app/views/effective/cpd_mailer/cpd_audit_conflicted.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_exemption_denied.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_exemption_granted.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_exemption_request.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_extension_denied.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_extension_granted.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_extension_request.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_opened.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_review_opened.liquid +15 -0
- data/app/views/effective/cpd_mailer/cpd_audit_review_ready.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_review_submitted.liquid +11 -0
- data/app/views/effective/cpd_mailer/cpd_audit_reviewed.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_submitted.liquid +13 -0
- data/app/views/effective/cpd_statement_activities/_cpd_statement_activity.html.haml +65 -0
- data/app/views/effective/cpd_statement_activities/_form.html.haml +10 -10
- data/app/views/effective/cpd_statements/_activities.html.haml +3 -64
- data/app/views/effective/cpd_statements/_activities_edit.html.haml +2 -0
- data/app/views/effective/cpd_statements/_activities_new.html.haml +3 -0
- data/app/views/effective/cpd_statements/_activities_table.html.haml +64 -0
- data/app/views/effective/cpd_statements/_agreements.html.haml +19 -5
- data/app/views/effective/cpd_statements/_cpd_statement.html.haml +6 -3
- data/app/views/effective/cpd_statements/_layout.html.haml +3 -4
- data/app/views/effective/cpd_statements/_summary.html.haml +26 -31
- data/app/views/effective/cpd_statements/activities.html.haml +1 -1
- data/app/views/effective/cpd_statements/agreements.html.haml +7 -1
- data/app/views/effective/cpd_statements/submit.html.haml +2 -3
- data/config/effective_cpd.rb +49 -10
- data/config/routes.rb +19 -1
- data/db/migrate/01_create_effective_cpd.rb.erb +175 -1
- data/db/seeds.rb +16 -13
- data/lib/effective_cpd.rb +42 -3
- data/lib/effective_cpd/engine.rb +7 -0
- data/lib/effective_cpd/version.rb +1 -1
- data/lib/generators/effective_cpd/install_generator.rb +18 -3
- metadata +175 -9
- data/app/datatables/effective_cpd_statements_datatable.rb +0 -23
- data/app/views/admin/cpd_statements/_form.html.haml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f74220d92f6cb570ae692fae9610f7aa3c16435f025381cda0f1d76d37eb462
|
4
|
+
data.tar.gz: 5370d91a541e895acccdfe6249e7fab92083bd2e7a39138a5f1c37fe0f6141f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62863f2ebce7908df8170c7e981c026e2e16eff493376a2c21c00bfdeaeee1a2dd394713bfa5be6d1986452cd519ac6d94000f15c38ec8d5c3e561c4dd8eb297
|
7
|
+
data.tar.gz: f039df8345571dc4812372211026330d2fb69bc20eb398110cb8e0a5831273c4940132770dfdcb85212867e8b1beb5c7761b81ea52ae6b803f4579d65c48e4f3
|
data/README.md
CHANGED
@@ -43,19 +43,66 @@ Then migrate the database:
|
|
43
43
|
rake db:migrate
|
44
44
|
```
|
45
45
|
|
46
|
-
|
46
|
+
Please add the following to your User model:
|
47
|
+
|
48
|
+
```
|
49
|
+
has_many :cpd_statements, -> { Effective::CpdStatement.sorted }, class_name: 'Effective::CpdStatement'
|
50
|
+
```
|
51
|
+
|
52
|
+
Use the following datatables to display to your user their statements and audits and audit reviews:
|
47
53
|
|
48
54
|
```haml
|
49
55
|
%h2 Continuing Professional Development
|
50
56
|
|
51
|
-
|
52
|
-
=
|
57
|
+
- # Auditee datatables (4)
|
58
|
+
- auditing = EffectiveCpdAvailableAuditsDatatable.new(self)
|
59
|
+
- if auditing.present?
|
60
|
+
.mt-4
|
61
|
+
%p You have been selected for audit:
|
62
|
+
= render_datatable(auditing, simple: true)
|
63
|
+
|
64
|
+
- audited = EffectiveCpdCompletedAuditsDatatable.new(self)
|
65
|
+
- if audited.present?
|
66
|
+
.mt-4
|
67
|
+
%p You have completed these past audits:
|
68
|
+
= render_datatable(audited, simple: true)
|
69
|
+
|
70
|
+
- available = EffectiveCpdAvailableCyclesDatatable.new(self)
|
71
|
+
- if available.present?
|
72
|
+
.mt-4
|
73
|
+
%p Please submit a CPD statement for the following available #{cpd_cycles_label}:
|
74
|
+
= render_datatable(available, simple: true)
|
75
|
+
|
76
|
+
- completed = EffectiveCpdCompletedStatementsDatatable.new(self)
|
77
|
+
- if completed.present?
|
78
|
+
.mt-4
|
79
|
+
%p You have completed these past statements:
|
80
|
+
= render_datatable(completed, simple: true)
|
53
81
|
|
54
|
-
-
|
55
|
-
-
|
82
|
+
- # Auditor / Audit reviewer datatables (2)
|
83
|
+
- reviewing = EffectiveCpdAvailableAuditReviewsDatatable.new(self)
|
84
|
+
- if reviewing.present?
|
56
85
|
.mt-4
|
57
|
-
%p You
|
58
|
-
= render_datatable(
|
86
|
+
%p You have been selected to review the following audits:
|
87
|
+
= render_datatable(reviewing, simple: true)
|
88
|
+
|
89
|
+
- reviewed = EffectiveCpdCompletedAuditReviewsDatatable.new(self)
|
90
|
+
- if reviewed.present?
|
91
|
+
.mt-4
|
92
|
+
%p You have completed these past audit reviews:
|
93
|
+
= render_datatable(reviewed, simple: true)
|
94
|
+
```
|
95
|
+
|
96
|
+
On the Admin::Users#edit, you can use the following datatables as well:
|
97
|
+
|
98
|
+
```haml
|
99
|
+
%h2 CPD Statements
|
100
|
+
- datatable = Admin::EffectiveCpdStatementsDatatable.new(user_id: user.id, user_type: user.class.name)
|
101
|
+
= render_datatable(datatable, inline: true)
|
102
|
+
|
103
|
+
%h2 CPD Audits
|
104
|
+
- datatable = Admin::EffectiveCpdAuditsDatatable.new(user_id: user.id, user_type: user.class.name)
|
105
|
+
= render_datatable(datatable)
|
59
106
|
|
60
107
|
```
|
61
108
|
|
@@ -63,9 +110,61 @@ Add a link to the admin menu:
|
|
63
110
|
|
64
111
|
```haml
|
65
112
|
- if can? :admin, :effective_cpd
|
66
|
-
|
67
|
-
|
68
|
-
|
113
|
+
- if can? :index, Effective::CpdCategory
|
114
|
+
= nav_link_to 'CPD Categories', effective_cpd.admin_cpd_categories_path
|
115
|
+
|
116
|
+
- if can? :index, Effective::CpdCycle
|
117
|
+
= nav_link_to 'CPD Cycles', effective_cpd.admin_cpd_cycles_path
|
118
|
+
|
119
|
+
- if can? :index, Effective::CpdAuditLevel
|
120
|
+
= nav_link_to 'CPD Audit Levels', effective_cpd.admin_cpd_audit_levels_path
|
121
|
+
|
122
|
+
= nav_divider
|
123
|
+
|
124
|
+
- if can? :index, Effective::CpdStatement
|
125
|
+
= nav_link_to 'CPD Statements', effective_cpd.admin_cpd_statements_path
|
126
|
+
|
127
|
+
- if can? :index, Effective::CpdAudit
|
128
|
+
= nav_link_to 'CPD Audits', effective_cpd.admin_cpd_audits_path
|
129
|
+
```
|
130
|
+
|
131
|
+
## Configuration
|
132
|
+
|
133
|
+
As an admin, visit the CPD Categories, then CPD Cycles, and CPD Audit levels.
|
134
|
+
|
135
|
+
Once all these 3 areas have been configured, users can submit statements and audits can be performed.
|
136
|
+
|
137
|
+
## Required Score
|
138
|
+
|
139
|
+
You can specify the required score in the CPD Cycle.
|
140
|
+
|
141
|
+
You can also programatically do it. Add the following to your user class.
|
142
|
+
|
143
|
+
```
|
144
|
+
# This is an ActiveRecord concern to add the has_many :cpd_statements
|
145
|
+
effective_cpd_user
|
146
|
+
|
147
|
+
# We require 100 points in the last 3 years.
|
148
|
+
def cpd_statement_required_score(cpd_statement)
|
149
|
+
# We always consider the 3 year window, of the passed cpd_statement and the last two statements
|
150
|
+
last_two_statements = cpd_statements.select do |statement|
|
151
|
+
statement.completed? && statement.cpd_cycle_id < cpd_statement.cpd_cycle_id
|
152
|
+
end.last(2)
|
153
|
+
|
154
|
+
# They can submit 0 0 100
|
155
|
+
return 0 if last_two_statements.length < 2
|
156
|
+
|
157
|
+
# 100 points in the last 3 years.
|
158
|
+
required_score = 100
|
159
|
+
|
160
|
+
# Score so far
|
161
|
+
existing_score = last_two_statements.sum { |statement| statement.score }
|
162
|
+
raise('expected existing_score to be >= 0') if existing_score < 0
|
163
|
+
|
164
|
+
# Required score minus previous
|
165
|
+
return 0 if existing_score >= required_score
|
166
|
+
(required_score - existing_score)
|
167
|
+
end
|
69
168
|
```
|
70
169
|
|
71
170
|
## Authorization
|
@@ -83,6 +182,12 @@ if user.persisted?
|
|
83
182
|
can [:index, :show, :update], Effective::CpdStatement, user_id: user.id
|
84
183
|
can [:index, :show], Effective::CpdCycle
|
85
184
|
can([:create, :update, :destroy], Effective::CpdStatementActivity) { |sa| sa.cpd_statement.user_id == user.id }
|
185
|
+
can [:index, :show, :update], Effective::CpdAudit, user_id: user.id
|
186
|
+
end
|
187
|
+
|
188
|
+
if user.reviewer?
|
189
|
+
can [:index], Effective::CpdAudit
|
190
|
+
can [:index, :show, :update], Effective::CpdAuditReview, user_id: user.id
|
86
191
|
end
|
87
192
|
|
88
193
|
if user.admin?
|
@@ -91,7 +196,14 @@ if user.admin?
|
|
91
196
|
can :manage, Effective::CpdCategory
|
92
197
|
can :manage, Effective::CpdCycle
|
93
198
|
can :manage, Effective::CpdRule
|
199
|
+
|
200
|
+
can :manage, Effective::CpdAuditLevel
|
201
|
+
can :manage, Effective::CpdAuditLevelSection
|
202
|
+
can :manage, Effective::CpdAuditLevelQuestion
|
203
|
+
|
94
204
|
can :manage, Effective::CpdStatement
|
205
|
+
can :manage, Effective::CpdAudit
|
206
|
+
can :manage, Effective::CpdAuditReview
|
95
207
|
end
|
96
208
|
```
|
97
209
|
|
@@ -44,6 +44,12 @@ $(document).on('click', '[data-cpd-edit-activity]', function(event) {
|
|
44
44
|
$activity.children('.statement-activity-form').show()
|
45
45
|
});
|
46
46
|
|
47
|
+
// When we click any x button
|
48
|
+
$(document).on('click', '[data-cpd-collapse]', function(event) {
|
49
|
+
event.preventDefault()
|
50
|
+
collapse_effective_cpd_activities()
|
51
|
+
});
|
52
|
+
|
47
53
|
// Initializers
|
48
54
|
$(document).ready(function() { initialize_effective_cpd_activities() });
|
49
55
|
$(document).on('turbolinks:load', function() { initialize_effective_cpd_activities() });
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Admin
|
2
|
+
class CpdAuditLevelQuestionsController < ApplicationController
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
4
|
+
before_action { EffectiveResources.authorize!(self, :admin, :effective_cpd) }
|
5
|
+
|
6
|
+
include Effective::CrudController
|
7
|
+
|
8
|
+
def permitted_params
|
9
|
+
params.require(:effective_cpd_audit_level_question).permit!
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Admin
|
2
|
+
class CpdAuditLevelsController < ApplicationController
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
4
|
+
before_action { EffectiveResources.authorize!(self, :admin, :effective_cpd) }
|
5
|
+
|
6
|
+
include Effective::CrudController
|
7
|
+
|
8
|
+
def permitted_params
|
9
|
+
params.require(:effective_cpd_audit_level).permit!
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Admin
|
2
|
+
class CpdAuditReviewsController < ApplicationController
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
4
|
+
before_action { EffectiveResources.authorize!(self, :admin, :effective_cpd) }
|
5
|
+
|
6
|
+
include Effective::CrudController
|
7
|
+
|
8
|
+
def permitted_params
|
9
|
+
params.require(:effective_cpd_audit_review).permit!
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Admin
|
2
|
+
class CpdAuditsController < ApplicationController
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
4
|
+
before_action { EffectiveResources.authorize!(self, :admin, :effective_cpd) }
|
5
|
+
|
6
|
+
include Effective::CrudController
|
7
|
+
|
8
|
+
submit :resolve_conflict, 'Resolve Conflict of Interest', success: -> {
|
9
|
+
[
|
10
|
+
"Successfully resolved #{resource}",
|
11
|
+
("and sent #{resource.user.email} a notification" unless resource.email_form_skip?)
|
12
|
+
].compact.join(' ')
|
13
|
+
}
|
14
|
+
|
15
|
+
submit :close, 'Close Audit', success: -> {
|
16
|
+
[
|
17
|
+
"Successfully closed #{resource}",
|
18
|
+
("and sent #{resource.user.email} a notification" unless resource.email_form_skip?)
|
19
|
+
].compact.join(' ')
|
20
|
+
}
|
21
|
+
|
22
|
+
submit :process_exemption, 'Process Exemption Request', success: -> {
|
23
|
+
[
|
24
|
+
"Successfully #{resource.status.gsub('_', ' ')} #{resource}",
|
25
|
+
("and sent #{resource.user.email} a notification" unless resource.email_form_skip?)
|
26
|
+
].compact.join(' ')
|
27
|
+
}
|
28
|
+
|
29
|
+
submit :process_extension, 'Process Extension Request', success: -> {
|
30
|
+
[
|
31
|
+
"Successfully #{resource.status.gsub('_', ' ')} #{resource}",
|
32
|
+
("and sent #{resource.user.email} a notification" unless resource.email_form_skip?)
|
33
|
+
].compact.join(' ')
|
34
|
+
}
|
35
|
+
|
36
|
+
def permitted_params
|
37
|
+
params.require(:effective_cpd_audit).permit!
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Admin
|
2
|
+
class CpdSpecialRulesController < ApplicationController
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
4
|
+
before_action { EffectiveResources.authorize!(self, :admin, :effective_cpd) }
|
5
|
+
|
6
|
+
include Effective::CrudController
|
7
|
+
|
8
|
+
def permitted_params
|
9
|
+
params.require(:effective_cpd_special_rule).permit!
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Effective
|
2
|
+
class CpdAuditReviewsController < ApplicationController
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
4
|
+
|
5
|
+
include Effective::WizardController
|
6
|
+
|
7
|
+
resource_scope do
|
8
|
+
Effective::CpdAuditReview.deep.where(user: current_user)
|
9
|
+
end
|
10
|
+
|
11
|
+
# Reuse the same view for all cpd_audit_level_section steps
|
12
|
+
# https://github.com/zombocom/wicked/blob/v1.3.4/lib/wicked/controller/concerns/render_redirect.rb#L32
|
13
|
+
def render_step(the_step, options = {}, params = {})
|
14
|
+
if resource.dynamic_wizard_statement_steps.keys.include?(the_step)
|
15
|
+
render('cpd_statement', options)
|
16
|
+
elsif resource.dynamic_wizard_questionnaire_steps.keys.include?(the_step)
|
17
|
+
render('cpd_audit_level_section', options)
|
18
|
+
else
|
19
|
+
super
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def permitted_params
|
24
|
+
case step
|
25
|
+
when :start
|
26
|
+
params.require(:effective_cpd_audit_review).permit(:current_step, :comments)
|
27
|
+
when :information
|
28
|
+
params.require(:effective_cpd_audit_review).permit(:current_step, :comments)
|
29
|
+
when :instructions
|
30
|
+
params.require(:effective_cpd_audit_review).permit(:current_step, :comments)
|
31
|
+
when :conflict
|
32
|
+
params.require(:effective_cpd_audit_review)
|
33
|
+
.permit(:current_step, :comments, :conflict_of_interest, :conflict_of_interest_reason)
|
34
|
+
when :statements
|
35
|
+
params.require(:effective_cpd_audit_review).permit(:current_step, :comments)
|
36
|
+
when :questionnaire
|
37
|
+
params.require(:effective_cpd_audit_review).permit(:current_step, :comments)
|
38
|
+
when :recommendation
|
39
|
+
params.require(:effective_cpd_audit_review).permit(:current_step, :comments, :recommendation)
|
40
|
+
when :submit
|
41
|
+
params.require(:effective_cpd_audit_review).permit(:current_step)
|
42
|
+
when :complete
|
43
|
+
raise('unexpected post to complete')
|
44
|
+
else
|
45
|
+
if step.to_s.start_with?('statement')
|
46
|
+
params.require(:effective_cpd_audit_review).permit(:current_step, :comments,
|
47
|
+
cpd_audit_review_items_attributes: [:id, :item_id, :item_type, :recommendation, :comments]
|
48
|
+
)
|
49
|
+
elsif step.to_s.start_with?('section')
|
50
|
+
params.require(:effective_cpd_audit_review).permit(:current_step, :comments,
|
51
|
+
cpd_audit_review_items_attributes: [:id, :item_id, :item_type, :recommendation, :comments]
|
52
|
+
)
|
53
|
+
else
|
54
|
+
raise('unexpected step')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Effective
|
2
|
+
class CpdAuditsController < ApplicationController
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
4
|
+
|
5
|
+
include Effective::WizardController
|
6
|
+
|
7
|
+
resource_scope do
|
8
|
+
Effective::CpdAudit.deep.where(user: current_user)
|
9
|
+
end
|
10
|
+
|
11
|
+
# Reuse the same view for all cpd_audit_level_section steps
|
12
|
+
# https://github.com/zombocom/wicked/blob/v1.3.4/lib/wicked/controller/concerns/render_redirect.rb#L32
|
13
|
+
def render_step(the_step, options = {}, params = {})
|
14
|
+
return super unless resource.dynamic_wizard_steps.keys.include?(the_step)
|
15
|
+
render('cpd_audit_level_section', options)
|
16
|
+
end
|
17
|
+
|
18
|
+
def permitted_params
|
19
|
+
case step
|
20
|
+
when :start
|
21
|
+
params.require(:effective_cpd_audit).permit(:current_step)
|
22
|
+
when :information
|
23
|
+
params.require(:effective_cpd_audit).permit(:current_step)
|
24
|
+
when :instructions
|
25
|
+
params.require(:effective_cpd_audit).permit(:current_step)
|
26
|
+
when :conflict
|
27
|
+
params.require(:effective_cpd_audit)
|
28
|
+
.permit(:current_step, :conflict_of_interest, :conflict_of_interest_reason)
|
29
|
+
when :exemption
|
30
|
+
params.require(:effective_cpd_audit)
|
31
|
+
.permit(:current_step, :exemption_request, :exemption_request_reason)
|
32
|
+
when :extension
|
33
|
+
params.require(:effective_cpd_audit)
|
34
|
+
.permit(:current_step, :extension_request, :extension_request_date, :extension_request_reason)
|
35
|
+
when :questionnaire
|
36
|
+
params.require(:effective_cpd_audit).permit(:current_step)
|
37
|
+
when :files
|
38
|
+
params.require(:effective_cpd_audit).permit(:current_step, files: [])
|
39
|
+
when :submit
|
40
|
+
params.require(:effective_cpd_audit).permit(:current_step)
|
41
|
+
when :complete
|
42
|
+
raise('unexpected post to complete')
|
43
|
+
else
|
44
|
+
raise('unexpected step') unless step.to_s.start_with?('section')
|
45
|
+
|
46
|
+
params.require(:effective_cpd_audit).permit(:current_step,
|
47
|
+
cpd_audit_responses_attributes: [
|
48
|
+
:id, :cpd_audit_id, :cpd_audit_level_question_id, :date, :email, :number, :long_answer, :short_answer, :upload_file, cpd_audit_level_question_option_ids: []
|
49
|
+
]
|
50
|
+
)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -2,6 +2,7 @@ module Effective
|
|
2
2
|
class CpdCyclesController < ApplicationController
|
3
3
|
before_action(:authenticate_user!) if defined?(Devise)
|
4
4
|
|
5
|
+
# If they visit /cpd_cycles/1, redirect to their statement for that cycle
|
5
6
|
def show
|
6
7
|
cycle = Effective::CpdCycle.find(params[:id])
|
7
8
|
EffectiveResources.authorize!(self, :show, cycle)
|
@@ -57,9 +57,7 @@ module Effective
|
|
57
57
|
:current_step, :confirm_read, :confirm_factual, files: []
|
58
58
|
)
|
59
59
|
when :submit
|
60
|
-
params.require(:effective_cpd_statement).permit(
|
61
|
-
:current_step, :confirm_readonly
|
62
|
-
)
|
60
|
+
params.require(:effective_cpd_statement).permit(:current_step, :confirm_readonly)
|
63
61
|
when :complete
|
64
62
|
raise('unexpected post to complete')
|
65
63
|
else
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Admin
|
2
|
+
class EffectiveCpdAuditLevelQuestionsDatatable < Effective::Datatable
|
3
|
+
datatable do
|
4
|
+
reorder :position
|
5
|
+
|
6
|
+
col :created_at, visible: false
|
7
|
+
col :updated_at, visible: false
|
8
|
+
col :id, visible: false
|
9
|
+
|
10
|
+
col :cpd_audit_level_section
|
11
|
+
|
12
|
+
col :position do |cpd_audit_level_question|
|
13
|
+
cpd_audit_level_question.position.to_i + 1
|
14
|
+
end
|
15
|
+
|
16
|
+
col :title
|
17
|
+
col :body
|
18
|
+
col :required
|
19
|
+
|
20
|
+
col :category, label: 'Type'
|
21
|
+
col :cpd_audit_level_question_options, label: 'Options'
|
22
|
+
|
23
|
+
actions_col
|
24
|
+
end
|
25
|
+
|
26
|
+
collection do
|
27
|
+
Effective::CpdAuditLevelQuestion.all.deep
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|