effective_cpd 0.1.5 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/effective/cpd_statements_controller.rb +1 -1
- data/app/models/effective/cpd_cycle.rb +1 -1
- data/app/models/effective/cpd_rule.rb +4 -4
- data/app/views/admin/cpd_cycles/_form_cpd_rules.html.haml +30 -27
- data/app/views/effective/cpd_statement_activities/_cpd_statement_activity.html.haml +2 -2
- data/app/views/effective/cpd_statement_activities/_form.html.haml +2 -2
- data/app/views/effective/cpd_statements/_activities_table.html.haml +1 -1
- data/lib/effective_cpd/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: 42fb9cbcba6674433f77a1b274d2855000a94724aa34fe8ded25177eb9171046
|
4
|
+
data.tar.gz: 7c3fa8934b17b16a67b4fccbc2f29eba4b3af1beb66fb82b07706526dca8c60b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82101c275e55d097ced7a9f214758ae33886e319d38649be8997dae6cb62512239f78621ca3ab4e4be27738adc2c2ad2982b5f21a0fffed16a936526bb1aa9de
|
7
|
+
data.tar.gz: a22f3d126c721f109e0e2fb3e32a5b9bec21caa6e8bd3f9196c010088d0be3e4534e7a47ecaa707df1547c2393ba4503b4f0f39ce47458a4ca77714c2219f120
|
@@ -22,7 +22,7 @@ module Effective
|
|
22
22
|
flash[:danger] = "You have already completed a statement for this #{cpd_cycle_label}."
|
23
23
|
redirect_to(root_path)
|
24
24
|
elsif existing.present?
|
25
|
-
flash[:success] = "You have been redirected to the #{resource_wizard_step_title(existing.next_step)} step."
|
25
|
+
flash[:success] = "You have been redirected to the #{resource_wizard_step_title(existing, existing.next_step)} step."
|
26
26
|
redirect_to effective_cpd.cpd_cycle_cpd_statement_build_path(existing.cpd_cycle, existing, existing.next_step)
|
27
27
|
end
|
28
28
|
end
|
@@ -81,7 +81,7 @@ module Effective
|
|
81
81
|
attributes = cycle.dup.attributes.except('title', 'token', 'start_at', 'end_at')
|
82
82
|
assign_attributes(attributes)
|
83
83
|
|
84
|
-
[:all_steps_content, :sidebar_content, :start_content, :activities_content, :submit_content, :complete_content].each do |rich_text|
|
84
|
+
[:all_steps_content, :sidebar_content, :start_content, :activities_content, :agreements_content, :submit_content, :complete_content].each do |rich_text|
|
85
85
|
self.send("#{rich_text}=", cycle.send(rich_text))
|
86
86
|
end
|
87
87
|
|
@@ -13,8 +13,8 @@ module Effective
|
|
13
13
|
log_changes(to: :cpd_cycle)
|
14
14
|
end
|
15
15
|
|
16
|
-
# Only permit the words amount, amount2 and any charater 0-9 + - / * ( )
|
17
|
-
INVALID_FORMULA_CHARS = /[^0-9
|
16
|
+
# Only permit the words amount, amount2 and any charater 0-9 + - / * . ( )
|
17
|
+
INVALID_FORMULA_CHARS = /[^0-9\+\-\.\/\*\(\)]/
|
18
18
|
|
19
19
|
effective_resource do
|
20
20
|
# A plaintext description of the formula
|
@@ -55,7 +55,7 @@ module Effective
|
|
55
55
|
|
56
56
|
validate(if: -> { formula.present? }) do
|
57
57
|
if formula.gsub('amount2', '').gsub('amount', '').gsub(' ', '').match(INVALID_FORMULA_CHARS).present?
|
58
|
-
self.errors.add(:formula, "may only contain amount, amount2 and 0-9 + - / * ( ) characters")
|
58
|
+
self.errors.add(:formula, "may only contain amount, amount2 and 0-9 + - / * . ( ) characters")
|
59
59
|
else
|
60
60
|
begin
|
61
61
|
eval_equation(amount: 0, amount2: 0)
|
@@ -118,7 +118,7 @@ module Effective
|
|
118
118
|
|
119
119
|
def eval_equation(amount: nil, amount2: nil)
|
120
120
|
equation = formula.gsub('amount2', amount2.to_s).gsub('amount', amount.to_s)
|
121
|
-
eval(equation).to_i
|
121
|
+
eval(equation).round.to_i
|
122
122
|
end
|
123
123
|
|
124
124
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
- edit_path = effective_cpd.edit_admin_cpd_category_path(cpd_category)
|
2
|
+
- cpd_rule = cpd_cycle.rule_for(cpd_category)
|
2
3
|
|
3
4
|
= effective_form_with(model: [:admin, cpd_cycle], engine: true) do |f|
|
4
5
|
%h2= cpd_category
|
@@ -22,40 +23,42 @@
|
|
22
23
|
|
23
24
|
= f.submit
|
24
25
|
|
25
|
-
|
26
|
-
%h2 Activities
|
27
|
-
- rules = cpd_category.cpd_activities.map { |activity| cpd_cycle.rule_for(activity) }
|
26
|
+
- unless cpd_rule.unavailable?
|
28
27
|
|
29
|
-
=
|
30
|
-
|
28
|
+
= effective_form_with(model: [:admin, cpd_cycle], engine: true) do |f|
|
29
|
+
%h2 Activities
|
30
|
+
- rules = cpd_category.cpd_activities.map { |activity| cpd_cycle.rule_for(activity) }
|
31
31
|
|
32
|
-
=
|
33
|
-
.
|
34
|
-
.col
|
35
|
-
%h5.card-title= activity
|
36
|
-
- if activity.body.present?
|
37
|
-
%p= activity.body
|
32
|
+
= f.fields_for :cpd_rules, rules do |fa|
|
33
|
+
- activity = fa.object.ruleable
|
38
34
|
|
39
|
-
|
35
|
+
= card do
|
36
|
+
.row
|
37
|
+
.col
|
38
|
+
%h5.card-title= activity
|
39
|
+
- if activity.body.present?
|
40
|
+
%p= activity.body
|
40
41
|
|
41
|
-
|
42
|
-
= f.static_field :amount2_label, value: activity.amount2_label.presence || '-'
|
43
|
-
= f.static_field :requires_upload_file, value: (activity.requires_upload_file ? 'Yes' : '-')
|
42
|
+
%p= link_to 'Edit Activity', edit_path, target: '_blank'
|
44
43
|
|
45
|
-
|
46
|
-
|
44
|
+
= f.static_field :amount_label, value: activity.amount_label.presence || '-'
|
45
|
+
= f.static_field :amount2_label, value: activity.amount2_label.presence || '-'
|
46
|
+
= f.static_field :requires_upload_file, value: (activity.requires_upload_file ? 'Yes' : '-')
|
47
47
|
|
48
|
-
|
49
|
-
|
48
|
+
.col
|
49
|
+
= fa.text_field :formula, hint: cpd_rule_formula_hint(activity)
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
hint: 'leave blank for no limit'
|
51
|
+
= fa.text_field :credit_description, label: "#{cpd_credits_label.titleize} description",
|
52
|
+
hint: "A simple description of the formula and its #{cpd_credits_label} calculation"
|
54
53
|
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
= fa.number_field :max_credits_per_cycle,
|
55
|
+
label: "Max #{cpd_credits_label} per #{cpd_cycle_label}",
|
56
|
+
hint: 'leave blank for no limit'
|
58
57
|
|
59
|
-
|
58
|
+
= fa.number_field :max_cycles_can_carry_forward,
|
59
|
+
label: "Max #{cpd_cycles_label} can carry forward",
|
60
|
+
hint: "leave blank for no limit. enter zero for no carry forward."
|
60
61
|
|
61
|
-
|
62
|
+
= fa.check_box :unavailable, label: "Unavailable in this #{cpd_cycle_label}"
|
63
|
+
|
64
|
+
= f.submit
|
@@ -21,13 +21,13 @@
|
|
21
21
|
.row
|
22
22
|
- if cpd_activity.amount_label.present?
|
23
23
|
.col
|
24
|
-
%strong
|
24
|
+
%strong= cpd_activity.amount_label
|
25
25
|
%br
|
26
26
|
= cpd_statement_activity.amount
|
27
27
|
|
28
28
|
- if cpd_activity.amount2_label.present?
|
29
29
|
.col.text-center
|
30
|
-
%strong
|
30
|
+
%strong= cpd_activity.amount2_label
|
31
31
|
= cpd_statement_activity.amount2
|
32
32
|
|
33
33
|
- if cpd_activity.amount_static?
|
@@ -41,10 +41,10 @@
|
|
41
41
|
.row
|
42
42
|
.col
|
43
43
|
- if activity.amount_label.present?
|
44
|
-
= f.number_field :amount, label: activity.amount_label
|
44
|
+
= f.number_field :amount, label: activity.amount_label, required: true
|
45
45
|
|
46
46
|
- if activity.amount2_label.present?
|
47
|
-
= f.number_field :amount2, label: activity.amount2_label
|
47
|
+
= f.number_field :amount2, label: activity.amount2_label, required: true
|
48
48
|
|
49
49
|
- if activity.amount_static?
|
50
50
|
= f.hidden_field :amount, value: 1
|
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.1.
|
4
|
+
version: 0.1.10
|
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: 2021-05-
|
11
|
+
date: 2021-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|