effective_memberships 0.3.13 → 0.4.1
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 +4 -4
- data/app/controllers/admin/organizations_controller.rb +19 -0
- data/app/controllers/admin/representatives_controller.rb +19 -0
- data/app/controllers/effective/applicants_controller.rb +2 -3
- data/app/controllers/effective/fee_payments_controller.rb +1 -2
- data/app/controllers/effective/organizations_controller.rb +16 -0
- data/app/controllers/effective/representatives_controller.rb +19 -0
- data/app/datatables/admin/effective_applicants_datatable.rb +10 -5
- data/app/datatables/admin/effective_categories_datatable.rb +7 -0
- data/app/datatables/admin/effective_fee_payments_datatable.rb +11 -6
- data/app/datatables/admin/effective_organizations_datatable.rb +31 -0
- data/app/datatables/admin/effective_representatives_datatable.rb +28 -0
- data/app/datatables/effective_applicants_datatable.rb +1 -1
- data/app/datatables/effective_fee_payments_datatable.rb +5 -4
- data/app/datatables/effective_organizations_datatable.rb +18 -0
- data/app/datatables/effective_representatives_datatable.rb +40 -0
- data/app/helpers/effective_memberships_helper.rb +25 -0
- data/app/mailers/effective/memberships_mailer.rb +34 -15
- data/app/models/concerns/effective_memberships_applicant.rb +63 -30
- data/app/models/concerns/effective_memberships_category.rb +32 -5
- data/app/models/concerns/effective_memberships_fee_payment.rb +44 -45
- data/app/models/concerns/effective_memberships_organization.rb +94 -0
- data/app/models/concerns/effective_memberships_owner.rb +0 -55
- data/app/models/concerns/effective_memberships_registrar.rb +5 -3
- data/app/models/concerns/effective_memberships_user.rb +70 -0
- data/app/models/effective/fee.rb +1 -1
- data/app/models/effective/organization.rb +8 -0
- data/app/models/effective/registrar_action.rb +16 -1
- data/app/models/effective/representative.rb +56 -0
- data/app/views/admin/categories/_form_applicant_eligibility.html.haml +1 -1
- data/app/views/admin/categories/_form_applicant_steps.html.haml +29 -24
- data/app/views/admin/categories/_form_category.html.haml +3 -0
- data/app/views/admin/categories/_form_renewals.html.haml +0 -2
- data/app/views/admin/organizations/_fields.html.haml +6 -0
- data/app/views/admin/organizations/_form.html.haml +31 -0
- data/app/views/admin/organizations/_form_organization.html.haml +23 -0
- data/app/views/admin/registrar_actions/_form_fees_paid.html.haml +16 -0
- data/app/views/admin/representatives/_form.html.haml +38 -0
- data/app/views/{effective/applicants/_demographics_fields.html.haml → admin/representatives/_user_fields.html.haml} +2 -6
- data/app/views/effective/applicants/_dashboard.html.haml +24 -5
- data/app/views/effective/applicants/_demographics.html.haml +1 -1
- data/app/views/effective/applicants/_missing_info.html.haml +7 -3
- data/app/views/effective/applicants/_organization.html.haml +9 -0
- data/app/views/effective/applicants/_select_organization.html.haml +21 -0
- data/app/views/effective/applicants/_summary.html.haml +17 -9
- data/app/views/effective/applicants/billing.html.haml +2 -2
- data/app/views/effective/applicants/demographics.html.haml +7 -6
- data/app/views/effective/applicants/education.html.haml +2 -2
- data/app/views/effective/applicants/organization.html.haml +19 -0
- data/app/views/effective/applicants/references.html.haml +1 -1
- data/app/views/effective/applicants/select.html.haml +11 -1
- data/app/views/effective/applicants/stamp.html.haml +2 -2
- data/app/views/effective/applicants/start.html.haml +17 -11
- data/app/views/effective/applicants/submitted.html.haml +5 -5
- data/app/views/effective/applicants/summary.html.haml +1 -1
- data/app/views/effective/fee_payments/_demographics.html.haml +1 -1
- data/app/views/effective/fee_payments/_organization.html.haml +9 -0
- data/app/views/effective/fee_payments/_summary.html.haml +39 -1
- data/app/views/effective/fee_payments/billing.html.haml +2 -2
- data/app/views/effective/fee_payments/demographics.html.haml +2 -2
- data/app/views/effective/fee_payments/organization.html.haml +18 -0
- data/app/views/effective/fee_payments/start.html.haml +20 -17
- data/app/views/effective/fee_payments/submitted.html.haml +10 -3
- data/app/views/effective/fees/_dashboard.html.haml +20 -8
- data/app/views/effective/memberships/_dashboard.html.haml +16 -5
- data/app/views/effective/organizations/_dashboard.html.haml +10 -0
- data/app/views/effective/organizations/_form.html.haml +8 -0
- data/app/views/effective/organizations/_form_organization.html.haml +11 -0
- data/app/views/effective/representatives/_form.html.haml +33 -0
- data/app/views/effective/{fee_payments/_demographics_fields.html.haml → representatives/_user_fields.html.haml} +2 -6
- data/app/views/organizations/_demographics.html.haml +45 -0
- data/app/views/organizations/_fields_demographics.html.haml +29 -0
- data/app/views/users/_demographics.html.haml +50 -0
- data/app/views/users/_fields_demographics.html.haml +29 -0
- data/config/effective_memberships.rb +4 -0
- data/config/routes.rb +9 -0
- data/db/migrate/01_create_effective_memberships.rb.erb +57 -10
- data/db/seeds.rb +18 -0
- data/lib/effective_memberships/engine.rb +3 -0
- data/lib/effective_memberships/version.rb +1 -1
- data/lib/effective_memberships.rb +7 -3
- metadata +33 -20
- data/app/views/effective/applicants/_demographics_owner.html.haml +0 -20
- data/app/views/effective/fee_payments/_demographics_owner.html.haml +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2648e82170c5076854831eebdbaf7f972cbfeaf69076280253ad345ca1ac53db
|
4
|
+
data.tar.gz: 385ddec71ae2103c4f33c08dd732b52b13f87535b0a44c11131389c47b854703
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a581b0e79010b252b6e12cf3763d67eee879da8e4661f06c456b037dbcb220c1640d424f246c9d8a210e5d89acfe098fd61cc8a39d947aed46b30ca270ce934c
|
7
|
+
data.tar.gz: e45c087b0f7f9ea6fa7c2f03593b43da7a6d4451e39447d29ebdc7053422856b97dae45a28977cfb759170d5f278fb3046821070072176050fb551e07a1c4ccb
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Admin
|
2
|
+
class OrganizationsController < ApplicationController
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
4
|
+
before_action { EffectiveResources.authorize!(self, :admin, :effective_memberships) }
|
5
|
+
|
6
|
+
include Effective::CrudController
|
7
|
+
|
8
|
+
resource_scope -> { EffectiveMemberships.Organization.deep.all }
|
9
|
+
datatable -> { EffectiveResources.best('Admin::EffectiveMembershipsDatatable').new }
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def permitted_params
|
14
|
+
model = (params.key?(:effective_organization) ? :effective_organization : :organization)
|
15
|
+
params.require(model).permit!
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Admin
|
2
|
+
class RepresentativesController < ApplicationController
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
4
|
+
before_action { EffectiveResources.authorize!(self, :admin, :effective_memberships) }
|
5
|
+
|
6
|
+
include Effective::CrudController
|
7
|
+
|
8
|
+
resource_scope -> { Effective::Representative.deep.all }
|
9
|
+
datatable -> { Admin::EffectiveRepresentativesDatatable.new }
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def permitted_params
|
14
|
+
model = (params.key?(:effective_representative) ? :effective_representative : :representative)
|
15
|
+
params.require(model).permit!
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -4,9 +4,8 @@ module Effective
|
|
4
4
|
|
5
5
|
include Effective::WizardController
|
6
6
|
|
7
|
-
resource_scope -> { EffectiveMemberships.Applicant.deep.where(
|
8
|
-
|
9
|
-
submit :resubmit, 'Submit Application'
|
7
|
+
resource_scope -> { EffectiveMemberships.Applicant.deep.where(user: current_user) }
|
10
8
|
|
9
|
+
submit :resubmit, 'Resubmit Application'
|
11
10
|
end
|
12
11
|
end
|
@@ -4,7 +4,6 @@ module Effective
|
|
4
4
|
|
5
5
|
include Effective::WizardController
|
6
6
|
|
7
|
-
resource_scope -> { EffectiveMemberships.FeePayment.deep.where(
|
8
|
-
|
7
|
+
resource_scope -> { EffectiveMemberships.FeePayment.deep.where(user: current_user) }
|
9
8
|
end
|
10
9
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Effective
|
2
|
+
class OrganizationsController < ApplicationController
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
4
|
+
|
5
|
+
include Effective::CrudController
|
6
|
+
|
7
|
+
resource_scope -> { EffectiveMemberships.Organization.deep.where(id: current_user.organizations) }
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def permitted_params
|
12
|
+
params.require(:organization).permit!
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Effective
|
2
|
+
class RepresentativesController < ApplicationController
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
4
|
+
|
5
|
+
include Effective::CrudController
|
6
|
+
|
7
|
+
resource_scope -> {
|
8
|
+
organizations = EffectiveMemberships.Organization.deep.where(id: current_user.organizations)
|
9
|
+
Effective::Representative.deep.where(organization: organizations)
|
10
|
+
}
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def permitted_params
|
15
|
+
params.require(:effective_representative).permit!
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -26,7 +26,8 @@ module Admin
|
|
26
26
|
|
27
27
|
col :approved_at, label: 'Approved', visible: false, as: :date
|
28
28
|
|
29
|
-
col :
|
29
|
+
col :user
|
30
|
+
col :organization
|
30
31
|
|
31
32
|
col :applicant_type
|
32
33
|
col :category, search: { collection: EffectiveMemberships.Category.all, polymorphic: false }
|
@@ -40,14 +41,18 @@ module Admin
|
|
40
41
|
collection do
|
41
42
|
applicants = EffectiveMemberships.Applicant.deep.all
|
42
43
|
|
43
|
-
raise('expected
|
44
|
+
raise('expected a user_id or organization_id, not owner_id') if attributes[:owner_id].present?
|
44
45
|
|
45
|
-
if scope == :in_progress && attributes[:
|
46
|
+
if scope == :in_progress && attributes[:user_id].blank? && attributes[:organization_id].blank?
|
46
47
|
applicants = applicants.where.not(status: :draft)
|
47
48
|
end
|
48
49
|
|
49
|
-
if attributes[:
|
50
|
-
applicants = applicants.where(
|
50
|
+
if attributes[:user_id].present?
|
51
|
+
applicants = applicants.where(user_id: attributes[:owner_id])
|
52
|
+
end
|
53
|
+
|
54
|
+
if attributes[:organization_id].present?
|
55
|
+
applicants = applicants.where(organization_id: attributes[:organization_id])
|
51
56
|
end
|
52
57
|
|
53
58
|
if attributes[:except_id].present?
|
@@ -8,13 +8,20 @@ module Admin
|
|
8
8
|
col :id, visible: false
|
9
9
|
|
10
10
|
col :title
|
11
|
+
col :can_apply_new, label: 'Can Apply'
|
11
12
|
col :applicant_fee, as: :price
|
13
|
+
|
12
14
|
col :renewal_fee, as: :price
|
13
15
|
col :late_fee, as: :price
|
14
16
|
col :rich_text_body, label: 'Body'
|
15
17
|
col :tax_exempt
|
16
18
|
col :qb_item_name, visible: false
|
17
19
|
|
20
|
+
col :category_type, search: EffectiveMemberships.Category.category_types
|
21
|
+
|
22
|
+
col :optional_applicant_wizard_steps, label: 'Applicant Steps'
|
23
|
+
col :optional_fee_payment_wizard_steps, label: 'Fee Payment Steps'
|
24
|
+
|
18
25
|
actions_col
|
19
26
|
end
|
20
27
|
|
@@ -18,7 +18,8 @@ module Admin
|
|
18
18
|
col :period, visible: false
|
19
19
|
col :submitted_at, label: 'Submitted', visible: false, as: :date
|
20
20
|
|
21
|
-
col :
|
21
|
+
col :user
|
22
|
+
col :organization
|
22
23
|
|
23
24
|
col :category, search: { collection: EffectiveMemberships.Category.all, polymorphic: false }
|
24
25
|
|
@@ -27,17 +28,21 @@ module Admin
|
|
27
28
|
actions_col
|
28
29
|
end
|
29
30
|
|
30
|
-
collection do
|
31
|
+
collection(apply_belongs_to: false) do
|
31
32
|
fee_payments = EffectiveMemberships.FeePayment.deep.all
|
32
33
|
|
33
|
-
raise('expected an
|
34
|
+
raise('expected an user_id but was given an owner_id') if attributes[:owner_id].present?
|
34
35
|
|
35
|
-
if fee_payments == :in_progress && attributes[:
|
36
|
+
if fee_payments == :in_progress && attributes[:user_id].blank? && attributes[:organization_id].blank?
|
36
37
|
fee_payments = fee_payments.where.not(status: :draft)
|
37
38
|
end
|
38
39
|
|
39
|
-
if attributes[:
|
40
|
-
fee_payments = fee_payments.where(
|
40
|
+
if attributes[:user_id].present?
|
41
|
+
fee_payments = fee_payments.where(user_id: attributes[:user_id])
|
42
|
+
end
|
43
|
+
|
44
|
+
if attributes[:organization_id].present?
|
45
|
+
fee_payments = fee_payments.where(organization_id: attributes[:organization_id])
|
41
46
|
end
|
42
47
|
|
43
48
|
if attributes[:except_id].present?
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Admin
|
2
|
+
class EffectiveOrganizationsDatatable < Effective::Datatable
|
3
|
+
datatable do
|
4
|
+
|
5
|
+
col :updated_at, visible: false
|
6
|
+
col :created_at, visible: false
|
7
|
+
|
8
|
+
col :id, visible: false
|
9
|
+
|
10
|
+
if categories.present?
|
11
|
+
col :category, search: categories
|
12
|
+
end
|
13
|
+
|
14
|
+
col :title
|
15
|
+
|
16
|
+
col :representatives_count
|
17
|
+
col :representatives
|
18
|
+
|
19
|
+
actions_col
|
20
|
+
end
|
21
|
+
|
22
|
+
collection do
|
23
|
+
EffectiveMemberships.Organization.deep.all
|
24
|
+
end
|
25
|
+
|
26
|
+
def categories
|
27
|
+
EffectiveMemberships.Organization.categories
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Admin
|
2
|
+
class EffectiveRepresentativesDatatable < Effective::Datatable
|
3
|
+
datatable do
|
4
|
+
col :id, visible: false
|
5
|
+
col :user_id, visible: false
|
6
|
+
|
7
|
+
col :organization
|
8
|
+
col :user
|
9
|
+
|
10
|
+
col :email do |representative|
|
11
|
+
mail_to(representative.user.email)
|
12
|
+
end
|
13
|
+
|
14
|
+
col :roles, search: roles_collection
|
15
|
+
|
16
|
+
actions_col
|
17
|
+
end
|
18
|
+
|
19
|
+
collection do
|
20
|
+
Effective::Representative.deep.all
|
21
|
+
end
|
22
|
+
|
23
|
+
def roles_collection
|
24
|
+
EffectiveRoles.roles_collection(Effective::Representative.new).map(&:second)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -6,7 +6,9 @@ class EffectiveFeePaymentsDatatable < Effective::Datatable
|
|
6
6
|
col :token, visible: false
|
7
7
|
col :created_at, visible: false
|
8
8
|
|
9
|
-
col :
|
9
|
+
col :user
|
10
|
+
col :organization
|
11
|
+
|
10
12
|
col :status, visible: false
|
11
13
|
col :submitted_at, label: 'Submitted', as: :date
|
12
14
|
col :period, visible: false
|
@@ -16,9 +18,8 @@ class EffectiveFeePaymentsDatatable < Effective::Datatable
|
|
16
18
|
actions_col(new: false)
|
17
19
|
end
|
18
20
|
|
19
|
-
collection do
|
20
|
-
EffectiveMemberships.FeePayment.deep.done
|
21
|
-
.where(owner: current_user.effective_memberships_owners)
|
21
|
+
collection(apply_belongs_to: false) do
|
22
|
+
scope = EffectiveMemberships.FeePayment.deep.done.for(current_user)
|
22
23
|
end
|
23
24
|
|
24
25
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Dashboard Organizations
|
2
|
+
class EffectiveOrganizationsDatatable < Effective::Datatable
|
3
|
+
datatable do
|
4
|
+
order :title
|
5
|
+
|
6
|
+
col :id, visible: false
|
7
|
+
|
8
|
+
col :title
|
9
|
+
col :representatives
|
10
|
+
|
11
|
+
actions_col
|
12
|
+
end
|
13
|
+
|
14
|
+
collection do
|
15
|
+
EffectiveMemberships.Organization.deep.where(id: current_user.organizations)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
class EffectiveRepresentativesDatatable < Effective::Datatable
|
2
|
+
datatable do
|
3
|
+
col :id, visible: false
|
4
|
+
|
5
|
+
col :organization
|
6
|
+
col :user
|
7
|
+
|
8
|
+
unless attributes[:user_id]
|
9
|
+
col :email do |representative|
|
10
|
+
mail_to(representative.user.email)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
col :roles, search: roles_collection
|
15
|
+
|
16
|
+
unless attributes[:actions] == false
|
17
|
+
actions_col
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
collection do
|
23
|
+
scope = Effective::Representative.deep.all.where(organization: current_user.organizations)
|
24
|
+
|
25
|
+
if attributes[:organization_id]
|
26
|
+
scope = scope.where(organization_id: attributes[:organization_id])
|
27
|
+
end
|
28
|
+
|
29
|
+
if attributes[:user_id]
|
30
|
+
scope = scope.where(user_id: attributes[:user_id])
|
31
|
+
end
|
32
|
+
|
33
|
+
scope
|
34
|
+
end
|
35
|
+
|
36
|
+
def roles_collection
|
37
|
+
EffectiveRoles.roles_collection(Effective::Representative.new).map(&:second)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -8,4 +8,29 @@ module EffectiveMembershipsHelper
|
|
8
8
|
end.compact
|
9
9
|
end
|
10
10
|
|
11
|
+
def effective_memberships_select_applicant_organization_collection(resource)
|
12
|
+
user = (resource.respond_to?(:user) ? resource.user : resource)
|
13
|
+
raise('expected an effective memberships user') unless user.class.try(:effective_memberships_user?)
|
14
|
+
|
15
|
+
representatives = user.representatives.select { |rep| rep.is?(:owner) || rep.is?(:billing) }
|
16
|
+
organizations = representatives.map { |rep| [rep.organization.to_s, rep.organization.id] }
|
17
|
+
|
18
|
+
organizations + [['New Organization...', 'new']]
|
19
|
+
end
|
20
|
+
|
21
|
+
# This is the select yourself or organization field on FeePayments#start
|
22
|
+
def effective_memberships_select_fee_payment_organization(resource)
|
23
|
+
user = (resource.respond_to?(:user) ? resource.user : resource)
|
24
|
+
raise('expected an effective memberships user') unless user.class.try(:effective_memberships_user?)
|
25
|
+
|
26
|
+
owners = user.memberships_owners.select { |owner| owner.outstanding_fee_payment_fees.present? }
|
27
|
+
|
28
|
+
owners.map do |owner|
|
29
|
+
[
|
30
|
+
owner.to_s,
|
31
|
+
(owner.to_param if owner.kind_of?(EffectiveMemberships.Organization)) # Nil when user
|
32
|
+
]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
11
36
|
end
|
@@ -1,49 +1,68 @@
|
|
1
1
|
module Effective
|
2
2
|
class MembershipsMailer < EffectiveMemberships.parent_mailer_class
|
3
3
|
|
4
|
+
include EffectiveMailer
|
4
5
|
include EffectiveEmailTemplatesMailer if EffectiveMemberships.use_effective_email_templates
|
5
6
|
|
6
|
-
default from: -> { EffectiveMemberships.mailer_sender }
|
7
|
-
layout -> { EffectiveMemberships.mailer_layout }
|
8
|
-
|
9
7
|
def applicant_completed(resource, opts = {})
|
10
8
|
@assigns = assigns_for(resource)
|
11
|
-
|
9
|
+
@applicant = resource
|
10
|
+
|
11
|
+
subject = subject_for(__method__, 'Applicant Completed', resource, opts)
|
12
|
+
headers = headers_for(resource, opts)
|
13
|
+
|
14
|
+
mail(to: resource.user.email, subject: subject, **headers)
|
12
15
|
end
|
13
16
|
|
14
17
|
def applicant_missing_info(resource, opts = {})
|
15
18
|
@assigns = assigns_for(resource)
|
16
|
-
|
19
|
+
@applicant = resource
|
20
|
+
|
21
|
+
subject = subject_for(__method__, 'Applicant Missing Info', resource, opts)
|
22
|
+
headers = headers_for(resource, opts)
|
23
|
+
|
24
|
+
mail(to: resource.user.email, subject: subject, **headers)
|
17
25
|
end
|
18
26
|
|
19
27
|
def applicant_approved(resource, opts = {})
|
20
28
|
@assigns = assigns_for(resource)
|
21
|
-
|
29
|
+
@applicant = resource
|
30
|
+
|
31
|
+
subject = subject_for(__method__, 'Applicant Approved', resource, opts)
|
32
|
+
headers = headers_for(resource, opts)
|
33
|
+
|
34
|
+
mail(to: resource.user.email, subject: subject, **headers)
|
22
35
|
end
|
23
36
|
|
24
37
|
def applicant_declined(resource, opts = {})
|
25
38
|
@assigns = assigns_for(resource)
|
26
|
-
|
39
|
+
@applicant = resource
|
40
|
+
|
41
|
+
subject = subject_for(__method__, 'Applicant Declined', resource, opts)
|
42
|
+
headers = headers_for(resource, opts)
|
43
|
+
|
44
|
+
mail(to: resource.user.email, subject: subject, **headers)
|
27
45
|
end
|
28
46
|
|
29
47
|
def applicant_reference_notification(resource, opts = {})
|
30
48
|
@assigns = assigns_for(resource)
|
31
|
-
|
32
|
-
end
|
49
|
+
@applicant_reference = resource
|
33
50
|
|
34
|
-
|
51
|
+
subject = subject_for(__method__, 'Reference Requested', resource, opts)
|
52
|
+
headers = headers_for(resource, opts)
|
35
53
|
|
36
|
-
|
37
|
-
resource.respond_to?(:log_changes_datatable) ? opts.merge(log: resource) : opts
|
54
|
+
mail(to: resource.email, subject: subject, **headers)
|
38
55
|
end
|
39
56
|
|
57
|
+
protected
|
58
|
+
|
40
59
|
def assigns_for(resource)
|
41
60
|
if resource.class.respond_to?(:effective_memberships_applicant?)
|
42
|
-
return applicant_assigns(resource).merge(
|
61
|
+
return applicant_assigns(resource).merge(owner_assigns(resource.owner))
|
43
62
|
end
|
44
63
|
|
45
64
|
if resource.kind_of?(Effective::ApplicantReference)
|
46
|
-
return reference_assigns(resource).merge(
|
65
|
+
return reference_assigns(resource).merge(owner_assigns(resource.applicant.owner))
|
47
66
|
end
|
48
67
|
|
49
68
|
raise('unexpected resource')
|
@@ -80,7 +99,7 @@ module Effective
|
|
80
99
|
{ reference: values }
|
81
100
|
end
|
82
101
|
|
83
|
-
def
|
102
|
+
def owner_assigns(owner)
|
84
103
|
raise('expected a owner') unless owner.class.respond_to?(:effective_memberships_owner?)
|
85
104
|
|
86
105
|
values = {
|