effective_cpd 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: deb0da2dfd0958689944cea459a4e237ac5f765cecb2b5fc081e513b1b648f38
4
- data.tar.gz: 913951e4a77ffa9fa00c22fb8c153702c7b05d3a9aefdeb4eaa90d3af0495a7d
3
+ metadata.gz: d431d1c016484d56c812b1e62e51203d8d6dcc9a626452e3e0275a194126f045
4
+ data.tar.gz: af7ef23916669b65010a86afe274c65cc123662a95b30d69c96cd6767eae41f6
5
5
  SHA512:
6
- metadata.gz: '08548deb0cbcbb5ad26f4f7d962b06ebda9d63e1e230ec7950c212f39ee83b97805bd133e1a9a807e77da7b8173e0e7443c60b3a19c86a93bb1bfa19c411c7ca'
7
- data.tar.gz: 9180db8bd3c9cb84fbf13bc136cda24a4996822ff8217b0a3ddfd88501e646160209698ecde6734f32ab2a831aae1e11ec5cbacea96bdc43c973750c983f2c44
6
+ metadata.gz: 64768ebc20002cc568e939d0ed694edc7d293899a3470529a42a88100a3a94dfd27dbc379ed250cbf3a3439a4abef84b9cefa95f4d00edfba8fea9d9ecfbb9bc
7
+ data.tar.gz: 91b7b3f4853dfd810c98039949f3ac1d00fc4d0a6ba95aa51745809d683b142ff21fc74ab397659b473d8620b3de1097be27e2b93065720ba09ec3f28a18aa67
@@ -68,6 +68,7 @@ module EffectiveCpdAudit
68
68
  start: 'Start',
69
69
  information: 'Information',
70
70
  instructions: 'Instructions',
71
+ demographics: 'Demographics', # Individual only. Users fields.
71
72
 
72
73
  # These 4 steps are determined by audit_level settings
73
74
  conflict: 'Conflict of Interest',
@@ -90,7 +91,9 @@ module EffectiveCpdAudit
90
91
 
91
92
  # App scoped
92
93
  belongs_to :cpd_audit_level, polymorphic: true
94
+
93
95
  belongs_to :user, polymorphic: true # The user being audited
96
+ accepts_nested_attributes_for :user
94
97
 
95
98
  has_many :cpd_audit_reviews, -> { order(:id) }, inverse_of: :cpd_audit, dependent: :destroy
96
99
  accepts_nested_attributes_for :cpd_audit_reviews, allow_destroy: true
@@ -238,7 +241,7 @@ module EffectiveCpdAudit
238
241
  end
239
242
 
240
243
  def required_steps
241
- steps = [:start, :information, :instructions]
244
+ steps = [:start, :information, :instructions, :demographics]
242
245
 
243
246
  steps << :conflict if cpd_audit_level.conflict_of_interest?
244
247
 
@@ -3,6 +3,7 @@
3
3
 
4
4
  - steps = cpd_audit.required_steps.select { |step| cpd_audit.has_completed_step?(step) }
5
5
  - blacklist = [:start, :information, :instructions, :waiting, :questionnaire, :submit, :submitted]
6
+ - blacklist += [:demographics] if cpd_audit.anonymous?
6
7
 
7
8
  - (steps - blacklist).each do |step|
8
9
  - cpd_audit.render_step = step
@@ -0,0 +1,3 @@
1
+ = wizard_card(cpd_audit) do
2
+ - raise('demographics should not be displayed on anonymous audit') if cpd_audit.anonymous?
3
+ = render 'users/demographics', parent: cpd_audit, user: cpd_audit.user
@@ -0,0 +1,9 @@
1
+ = render('layout') do
2
+
3
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
4
+ = f.hidden_field :current_step
5
+
6
+ = f.fields_for(:user, f.object.user) do |fu|
7
+ = render 'users/fields_demographics', f: fu, user: f.object.user, parent: resource
8
+
9
+ = f.save 'Save and Continue'
@@ -0,0 +1,61 @@
1
+ -# This is a placeholder file that should be overriden by the main application
2
+
3
+ %p Placeholder
4
+
5
+ %table.table.table-sm
6
+ %tbody
7
+ %tr
8
+ %th Name
9
+ %td= user.to_s
10
+
11
+ %tr
12
+ %th Email
13
+ %td= mail_to user.email
14
+
15
+ - if user.respond_to?(:job_title)
16
+ %tr
17
+ %th Job Title:
18
+ %td= user.job_title.presence || '-'
19
+
20
+ - if user.respond_to?(:date_of_birth)
21
+ %tr
22
+ %th Date of Birth
23
+ %td= user.date_of_birth&.strftime('%F').presence || '-'
24
+
25
+ - if user.respond_to?(:phone)
26
+ %tr
27
+ %th Phone:
28
+ %td= user.phone.presence || '-'
29
+
30
+ - if user.respond_to?(:home_phone)
31
+ %tr
32
+ %th Home Phone:
33
+ %td= user.home_phone.presence || '-'
34
+
35
+ - if user.respond_to?(:cell_phone)
36
+ %tr
37
+ %th Cell Phone:
38
+ %td= user.cell_phone.presence || '-'
39
+
40
+ - if user.respond_to?(:fax)
41
+ %tr
42
+ %th Fax:
43
+ %td= user.fax.presence || '-'
44
+
45
+ - if user.respond_to?(:residential_address)
46
+ %tr
47
+ %th Residential Address:
48
+ %td
49
+ - if user.residential_address.present?
50
+ = user.residential_address.to_html
51
+ - else
52
+ = '-'
53
+
54
+ - if user.respond_to?(:billing_address)
55
+ %tr
56
+ %th Billing Address:
57
+ %td
58
+ - if user.billing_address.present?
59
+ = user.billing_address.to_html
60
+ - else
61
+ = '-'
@@ -0,0 +1,31 @@
1
+ -# This is a placeholder file that should be overriden by the main application
2
+
3
+ %p Placeholder
4
+
5
+ - if f.object.respond_to?(:first_name)
6
+ = f.text_field :first_name
7
+
8
+ - if f.object.respond_to?(:last_name)
9
+ = f.text_field :last_name
10
+
11
+ - if f.object.respond_to?(:job_title)
12
+ = f.text_field :job_title
13
+
14
+ - if f.object.respond_to?(:date_of_birth)
15
+ = f.date_field :date_of_birth
16
+
17
+ - if f.object.respond_to?(:phone)
18
+ = f.tel_field :phone
19
+
20
+ - if f.object.respond_to?(:home_phone)
21
+ = f.tel_field :home_phone
22
+
23
+ - if f.object.respond_to?(:cell_phone)
24
+ = f.tel_field :cell_phone
25
+
26
+ - if f.object.respond_to?(:fax)
27
+ = f.tel_field :fax
28
+
29
+ - if f.object.respond_to?(:billing_address)
30
+ %h2 Billing Address
31
+ = effective_address_fields(f, :billing_address)
@@ -1,3 +1,3 @@
1
1
  module EffectiveCpd
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_cpd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
@@ -349,6 +349,7 @@ files:
349
349
  - app/views/effective/cpd_audits/_cpd.html.haml
350
350
  - app/views/effective/cpd_audits/_cpd_audit.html.haml
351
351
  - app/views/effective/cpd_audits/_cpd_audit_level_section.html.haml
352
+ - app/views/effective/cpd_audits/_demographics.html.haml
352
353
  - app/views/effective/cpd_audits/_exemption.html.haml
353
354
  - app/views/effective/cpd_audits/_extension.html.haml
354
355
  - app/views/effective/cpd_audits/_files.html.haml
@@ -360,6 +361,7 @@ files:
360
361
  - app/views/effective/cpd_audits/conflict.html.haml
361
362
  - app/views/effective/cpd_audits/cpd.html.haml
362
363
  - app/views/effective/cpd_audits/cpd_audit_level_section.html.haml
364
+ - app/views/effective/cpd_audits/demographics.html.haml
363
365
  - app/views/effective/cpd_audits/exemption.html.haml
364
366
  - app/views/effective/cpd_audits/extension.html.haml
365
367
  - app/views/effective/cpd_audits/files.html.haml
@@ -402,6 +404,8 @@ files:
402
404
  - app/views/effective/cpd_statements/complete.html.haml
403
405
  - app/views/effective/cpd_statements/start.html.haml
404
406
  - app/views/effective/cpd_statements/submit.html.haml
407
+ - app/views/users/_demographics.html.haml
408
+ - app/views/users/_fields_demographics.html.haml
405
409
  - config/effective_cpd.rb
406
410
  - config/routes.rb
407
411
  - db/migrate/01_create_effective_cpd.rb.erb