effective_memberships 0.4.10 → 0.4.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/datatables/effective_applicant_endorsements_datatable.rb +1 -0
- data/app/datatables/effective_applicant_equivalences_datatable.rb +23 -0
- data/app/datatables/effective_applicant_experiences_datatable.rb +1 -0
- data/app/models/concerns/effective_memberships_applicant.rb +18 -0
- data/app/models/concerns/effective_memberships_category.rb +2 -0
- data/app/models/effective/applicant_endorsement.rb +1 -1
- data/app/models/effective/applicant_equivalence.rb +32 -0
- data/app/views/admin/categories/_form_applicant_steps.html.haml +6 -0
- data/app/views/effective/applicants/_equivalences.html.haml +10 -0
- data/app/views/effective/applicants/course_amounts.html.haml +2 -0
- data/app/views/effective/applicants/declarations.html.haml +2 -0
- data/app/views/effective/applicants/education.html.haml +1 -1
- data/app/views/effective/applicants/endorsements.html.haml +12 -3
- data/app/views/effective/applicants/equivalences.html.haml +25 -0
- data/app/views/effective/applicants/experience.html.haml +2 -2
- data/app/views/effective/applicants/files.html.haml +2 -0
- data/app/views/effective/applicants/references.html.haml +2 -0
- data/db/migrate/01_create_effective_memberships.rb.erb +19 -0
- data/lib/effective_memberships/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a08504cb78fd8324ad3a72904249556ba0761b490a4574e1be3a4f6ac22ef51f
|
4
|
+
data.tar.gz: 409b51e03245bd8e331aeaf2acd038c111eb060e2852ffdfdbd282e4a20d7e9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca160549bff37e5194ca4eaea87f1479426b9f019631497892d564ec4e4be828dc41513085418c89a5b08aa3fa5b2190ee7eb30a3b84acec7f6b5f03a15ff82e
|
7
|
+
data.tar.gz: 184c786911efb0309e0d988e288f3d61f7ce9cb440e850e45a2c6fb13903e9a2f5eb79ef6b414a4b9f1365c3af9dfdd5536e050f780d1f50f60b19fd47008586
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class EffectiveApplicantEquivalencesDatatable < Effective::Datatable
|
2
|
+
datatable do
|
3
|
+
length :all
|
4
|
+
order :start_on
|
5
|
+
|
6
|
+
col :start_on
|
7
|
+
|
8
|
+
col :end_on do |applicant_equivalence|
|
9
|
+
applicant_equivalence.end_on&.strftime('%F') || '-'
|
10
|
+
end
|
11
|
+
|
12
|
+
col :name
|
13
|
+
col :notes
|
14
|
+
end
|
15
|
+
|
16
|
+
collection do
|
17
|
+
Effective::ApplicantEquivalence.deep.where(applicant: applicant)
|
18
|
+
end
|
19
|
+
|
20
|
+
def applicant
|
21
|
+
@applicant ||= EffectiveMemberships.Applicant.where(id: attributes[:applicant_id]).first!
|
22
|
+
end
|
23
|
+
end
|
@@ -96,6 +96,9 @@ module EffectiveMembershipsApplicant
|
|
96
96
|
has_many :applicant_endorsements, -> { order(:id) }, class_name: 'Effective::ApplicantEndorsement', as: :applicant, inverse_of: :applicant, dependent: :destroy
|
97
97
|
accepts_nested_attributes_for :applicant_endorsements, reject_if: :all_blank, allow_destroy: true
|
98
98
|
|
99
|
+
has_many :applicant_equivalences, -> { order(:id) }, class_name: 'Effective::ApplicantEquivalence', as: :applicant, inverse_of: :applicant, dependent: :destroy
|
100
|
+
accepts_nested_attributes_for :applicant_equivalences, reject_if: :all_blank, allow_destroy: true
|
101
|
+
|
99
102
|
has_many :applicant_experiences, -> { order(:id) }, class_name: 'Effective::ApplicantExperience', as: :applicant, inverse_of: :applicant, dependent: :destroy
|
100
103
|
accepts_nested_attributes_for :applicant_experiences, reject_if: :all_blank, allow_destroy: true
|
101
104
|
|
@@ -251,6 +254,16 @@ module EffectiveMembershipsApplicant
|
|
251
254
|
end
|
252
255
|
end
|
253
256
|
|
257
|
+
# Applicant Equivalences Step
|
258
|
+
with_options(if: -> { current_step == :equivalences }) do
|
259
|
+
validate do
|
260
|
+
required = min_applicant_equivalences()
|
261
|
+
existing = applicant_equivalences().reject(&:marked_for_destruction?).length
|
262
|
+
|
263
|
+
self.errors.add(:applicant_equivalences, "please include #{required} or more equivalences") if existing < required
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
254
267
|
# Applicant References Step
|
255
268
|
with_options(if: -> { current_step == :references }) do
|
256
269
|
validate do
|
@@ -540,6 +553,11 @@ module EffectiveMembershipsApplicant
|
|
540
553
|
category&.min_applicant_endorsements.to_i
|
541
554
|
end
|
542
555
|
|
556
|
+
# Equivalences Step
|
557
|
+
def min_applicant_equivalences
|
558
|
+
category&.min_applicant_equivalences.to_i
|
559
|
+
end
|
560
|
+
|
543
561
|
# Files Step
|
544
562
|
def min_applicant_files
|
545
563
|
category&.min_applicant_files.to_i
|
@@ -55,6 +55,8 @@ module EffectiveMembershipsCategory
|
|
55
55
|
applicant_wizard_steps :text
|
56
56
|
|
57
57
|
min_applicant_educations :integer
|
58
|
+
min_applicant_endorsements :integer
|
59
|
+
min_applicant_equivalences :integer
|
58
60
|
min_applicant_experiences_months :integer
|
59
61
|
min_applicant_references :integer
|
60
62
|
min_applicant_courses :integer
|
@@ -42,7 +42,7 @@ module Effective
|
|
42
42
|
|
43
43
|
# All step validations
|
44
44
|
validates :applicant, presence: true
|
45
|
-
validates :
|
45
|
+
validates :endorser_id, presence: true, unless: -> { unknown_member? }
|
46
46
|
|
47
47
|
with_options(if: -> { unknown_member? }) do
|
48
48
|
validates :endorser_email, presence: true, email: true
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Effective
|
2
|
+
class ApplicantEquivalence < ActiveRecord::Base
|
3
|
+
belongs_to :applicant, polymorphic: true
|
4
|
+
|
5
|
+
log_changes(to: :applicant) if respond_to?(:log_changes)
|
6
|
+
|
7
|
+
effective_resource do
|
8
|
+
name :string
|
9
|
+
|
10
|
+
start_on :date
|
11
|
+
end_on :date
|
12
|
+
|
13
|
+
notes :text
|
14
|
+
|
15
|
+
timestamps
|
16
|
+
end
|
17
|
+
|
18
|
+
scope :deep, -> { all }
|
19
|
+
|
20
|
+
validates :name, presence: true
|
21
|
+
validates :start_on, presence: true
|
22
|
+
|
23
|
+
validate(if: -> { start_on.present? && end_on.present? }) do
|
24
|
+
errors.add(:end_on, 'must be after start date') unless start_on < end_on
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_s
|
28
|
+
name || 'equivalence'
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -38,6 +38,12 @@
|
|
38
38
|
%td= f.number_field :min_applicant_endorsements, label: false
|
39
39
|
%td minimimum number of endorsements
|
40
40
|
|
41
|
+
- if applicant.wizard_step_keys.include?(:equivalences)
|
42
|
+
%tr
|
43
|
+
%td= applicant.wizard_step_title(:equivalences)
|
44
|
+
%td= f.number_field :min_applicant_equivalences, label: false
|
45
|
+
%td minimimum number of equivalent memberships
|
46
|
+
|
41
47
|
- if applicant.wizard_step_keys.include?(:references)
|
42
48
|
%tr
|
43
49
|
%td= applicant.wizard_step_title(:references)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
.card
|
2
|
+
.card-body
|
3
|
+
.row
|
4
|
+
.col-sm
|
5
|
+
%h5.card-title= applicant.wizard_step_title(:equivalences)
|
6
|
+
.col-sm-auto.text-right
|
7
|
+
= link_to('Edit', wizard_path(:equivalences)) if edit_effective_wizard?
|
8
|
+
|
9
|
+
- datatable = EffectiveApplicantEquivalencesDatatable.new(applicant: applicant)
|
10
|
+
.mb-4= render_simple_datatable(datatable)
|
@@ -22,6 +22,6 @@
|
|
22
22
|
|
23
23
|
= aef.text_field :degree_obtained, label: 'Degree, diploma or program'
|
24
24
|
|
25
|
-
|
25
|
+
= render_if_exists("effective/applicants/education_fields", f: f)
|
26
26
|
|
27
27
|
= f.save 'Save and Continue'
|
@@ -9,17 +9,26 @@
|
|
9
9
|
= effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
|
10
10
|
= f.hidden_field :id
|
11
11
|
|
12
|
+
- endorders_collection = Effective::ApplicantEndorsement.endorser_collection(resource)
|
13
|
+
|
12
14
|
= f.has_many(:applicant_endorsements, cards: true) do |aef|
|
15
|
+
- aef.object.endorser_type ||= endorders_collection.klass.name
|
16
|
+
|
13
17
|
%h4 Endorsement
|
14
18
|
|
15
|
-
= aef.
|
19
|
+
= aef.hidden_field :endorser_id
|
20
|
+
= aef.hidden_field :endorser_type
|
21
|
+
|
22
|
+
= aef.select :endorser_id, endorders_collection, required: false,
|
16
23
|
ajax_url: effective_memberships.select2_ajax_endorser_applicant_endorsement_path(applicant_id: resource)
|
17
24
|
|
18
25
|
= aef.check_box :unknown_member, label: 'I cant find my endorser in the above list'
|
19
26
|
|
20
27
|
= aef.show_if(:unknown_member, true) do
|
21
|
-
= aef.
|
22
|
-
= aef.
|
28
|
+
= aef.text_field :name, label: 'Endorser name', required: true
|
29
|
+
= aef.email_field :endorser_email, label: 'Email', required: true
|
23
30
|
= aef.phone_field :phone, required: true
|
24
31
|
|
32
|
+
= render_if_exists("effective/applicants/endorsements_fields", f: f)
|
33
|
+
|
25
34
|
= f.save 'Save and Continue'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
= render 'layout' do
|
2
|
+
= render 'effective/applicants/content', resource: resource
|
3
|
+
|
4
|
+
.card
|
5
|
+
.card-body
|
6
|
+
- if resource.min_applicant_equivalences > 0
|
7
|
+
.alert.alert-danger You must include #{resource.min_applicant_equivalences} or more equivalent memberships.
|
8
|
+
|
9
|
+
= effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
|
10
|
+
= f.hidden_field :id
|
11
|
+
|
12
|
+
= f.has_many(:applicant_equivalences, cards: true) do |aef|
|
13
|
+
%h4.mb-4 Equivalent Membership
|
14
|
+
|
15
|
+
= aef.text_field :name
|
16
|
+
|
17
|
+
.row
|
18
|
+
.col= aef.date_field :start_on, label: 'Start Date'
|
19
|
+
.col= aef.date_field :end_on, label: 'End Date'
|
20
|
+
|
21
|
+
= aef.text_area :notes
|
22
|
+
|
23
|
+
= render_if_exists("effective/applicants/equivalences_fields", f: f)
|
24
|
+
|
25
|
+
= f.save 'Save and Continue'
|
@@ -21,7 +21,7 @@
|
|
21
21
|
.row
|
22
22
|
.col= aef.date_field :start_on, label: 'Start Date', 'data-applicant-experiences-month': true
|
23
23
|
.col
|
24
|
-
= aef.date_field :end_on, label: 'End Date', 'data-applicant-experiences-month': true
|
24
|
+
= aef.date_field :end_on, label: 'End Date', required: false, 'data-applicant-experiences-month': true
|
25
25
|
= aef.check_box :still_work_here, label: 'I still work here'
|
26
26
|
|
27
27
|
.row
|
@@ -46,6 +46,6 @@
|
|
46
46
|
|
47
47
|
= f.error :applicant_experiences_months
|
48
48
|
|
49
|
-
|
49
|
+
= render_if_exists("effective/applicants/experience_fields", f: f)
|
50
50
|
|
51
51
|
= f.save 'Save and Continue'
|
@@ -21,4 +21,6 @@
|
|
21
21
|
.col= arf.select :relationship, Effective::ApplicantReference::RELATIONSHIPS
|
22
22
|
.col= arf.select :known, Effective::ApplicantReference::KNOWNS, label: 'Known for'
|
23
23
|
|
24
|
+
= render_if_exists("effective/applicants/references_fields", f: f)
|
25
|
+
|
24
26
|
= f.save 'Save and Continue'
|
@@ -25,6 +25,7 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
|
|
25
25
|
t.integer :min_applicant_experiences_months
|
26
26
|
t.integer :min_applicant_references
|
27
27
|
t.integer :min_applicant_endorsements
|
28
|
+
t.integer :min_applicant_equivalences
|
28
29
|
t.integer :min_applicant_courses
|
29
30
|
t.integer :min_applicant_files
|
30
31
|
|
@@ -325,6 +326,24 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
|
|
325
326
|
add_index :applicant_endorsements, :applicant_id
|
326
327
|
add_index :applicant_endorsements, :token
|
327
328
|
|
329
|
+
# Applicant Equivalences
|
330
|
+
create_table :applicant_equivalences do |t|
|
331
|
+
t.integer :applicant_id
|
332
|
+
t.string :applicant_type
|
333
|
+
|
334
|
+
t.string :name
|
335
|
+
|
336
|
+
t.date :start_on
|
337
|
+
t.date :end_on
|
338
|
+
|
339
|
+
t.text :notes
|
340
|
+
|
341
|
+
t.datetime :created_at
|
342
|
+
t.datetime :updated_at
|
343
|
+
end
|
344
|
+
|
345
|
+
add_index :applicant_equivalences, :applicant_id
|
346
|
+
|
328
347
|
# Applicant Courses
|
329
348
|
create_table :applicant_course_areas do |t|
|
330
349
|
t.string :title
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_memberships
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.11
|
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-06-
|
11
|
+
date: 2022-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -290,6 +290,7 @@ files:
|
|
290
290
|
- app/datatables/effective_applicant_courses_datatable.rb
|
291
291
|
- app/datatables/effective_applicant_educations_datatable.rb
|
292
292
|
- app/datatables/effective_applicant_endorsements_datatable.rb
|
293
|
+
- app/datatables/effective_applicant_equivalences_datatable.rb
|
293
294
|
- app/datatables/effective_applicant_experiences_datatable.rb
|
294
295
|
- app/datatables/effective_applicant_references_datatable.rb
|
295
296
|
- app/datatables/effective_applicants_datatable.rb
|
@@ -314,6 +315,7 @@ files:
|
|
314
315
|
- app/models/effective/applicant_course_name.rb
|
315
316
|
- app/models/effective/applicant_education.rb
|
316
317
|
- app/models/effective/applicant_endorsement.rb
|
318
|
+
- app/models/effective/applicant_equivalence.rb
|
317
319
|
- app/models/effective/applicant_experience.rb
|
318
320
|
- app/models/effective/applicant_reference.rb
|
319
321
|
- app/models/effective/applicant_review.rb
|
@@ -393,6 +395,7 @@ files:
|
|
393
395
|
- app/views/effective/applicants/_demographics.html.haml
|
394
396
|
- app/views/effective/applicants/_education.html.haml
|
395
397
|
- app/views/effective/applicants/_endorsements.html.haml
|
398
|
+
- app/views/effective/applicants/_equivalences.html.haml
|
396
399
|
- app/views/effective/applicants/_experience.html.haml
|
397
400
|
- app/views/effective/applicants/_files.html.haml
|
398
401
|
- app/views/effective/applicants/_layout.html.haml
|
@@ -411,6 +414,7 @@ files:
|
|
411
414
|
- app/views/effective/applicants/demographics.html.haml
|
412
415
|
- app/views/effective/applicants/education.html.haml
|
413
416
|
- app/views/effective/applicants/endorsements.html.haml
|
417
|
+
- app/views/effective/applicants/equivalences.html.haml
|
414
418
|
- app/views/effective/applicants/experience.html.haml
|
415
419
|
- app/views/effective/applicants/files.html.haml
|
416
420
|
- app/views/effective/applicants/organization.html.haml
|