effective_memberships 0.17.11 → 0.18.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e90584a4dd7e595fd89d9207612335911cee5a8e7353395447107972f88f6e3
4
- data.tar.gz: 9a066d33626c2014c8120148c8609ba44e69b5b0eebd9a63f91bc6e2f22176f4
3
+ metadata.gz: 72aa9c8faab61b20bcd7adfb56cae17f511d168c16707543ae3532be0a0f96e3
4
+ data.tar.gz: 87eea10d0571781ce2175bfbbd38a8cb8c175282ed7f85f5adbb154f20940c8b
5
5
  SHA512:
6
- metadata.gz: bcea744100d37ad68316f6029fba2a5ac3b39dc441a4459b4c060252647ff7011fb75d6e4a655de9cc8ad46848ff34700f6e3e04d4166f0ba4744bff30568462
7
- data.tar.gz: 1e7ebe17dc2f554576a43af5b6221f85635d7a583477541ec06b492bb01a819f7a047a18a530b048430696a6cc787ccc2b0953b3e3bf5415bd9af850b19f5f12
6
+ metadata.gz: e7e08dc7b8577ccee1602aa0a608c5a9daed8296d77a901c619ef8e2e94d12fb2de21fbf94b26c18934420491e86c413fa28c1de23a7372b32be68398b291d48
7
+ data.tar.gz: 6e49dc33467cda697043851ed8c9d7e67bfc9ad586a90c880efa5ff4c0142fb5cffce6f8b0f58d8c6b825a0e135f81f9b0811a8c12d241eb139c4306a6000ea4
data/README.md CHANGED
@@ -52,7 +52,7 @@ Use the following datatables to display to your user their applicants dues:
52
52
 
53
53
  ```haml
54
54
  %h2 Applications to Join
55
- - datatable = EffectiveMembershipsApplicantssDatatable.new(self)
55
+ - datatable = EffectiveMembershipsApplicantsDatatable.new(self)
56
56
  ```
57
57
 
58
58
  and
@@ -77,7 +77,7 @@ All authorization checks are handled via the effective_resources gem found in th
77
77
 
78
78
  ## Permissions
79
79
 
80
- The permissions you actually want to define are as follows (using CanCan):
80
+ The permissions you actually want to define are as follows (using CanCanCan):
81
81
 
82
82
  ```ruby
83
83
  # Regular signed up user. Guest users not supported.
@@ -92,6 +92,11 @@ if user.admin?
92
92
  end
93
93
  ```
94
94
 
95
+ ## Custom Greetings
96
+
97
+ It's possible to change how the owner and reviewer names are displayed in emails by adding a `email_to_s` method or overriding the `to_s` method in the resource - your `User` model.
98
+
99
+
95
100
  ## License
96
101
 
97
102
  MIT License. Copyright [Code and Effect Inc.](http://www.codeandeffect.com/)
@@ -36,6 +36,18 @@ module Admin
36
36
  ].compact.join(' ')
37
37
  }
38
38
 
39
+ submit :flag, 'Flag Applicant', success: -> {
40
+ [
41
+ "Successfully marked #{resource.owner} #{resource} as flagged"
42
+ ].compact.join(' ')
43
+ }
44
+
45
+ submit :unflag, 'Unflag Applicant', success: -> {
46
+ [
47
+ "Successfully marked #{resource.owner} #{resource} as unflagged"
48
+ ].compact.join(' ')
49
+ }
50
+
39
51
  private
40
52
 
41
53
  def permitted_params
@@ -13,6 +13,9 @@ module Admin
13
13
  col :id, visible: false
14
14
 
15
15
  col :status, search: effective_memberships_status_collection()
16
+ col :flagged
17
+ col :flagged_at, visible: false
18
+ col :flagged_reason, visible: false
16
19
 
17
20
  col :created_at, label: 'Created', as: :date, visible: false
18
21
  col :updated_at, label: 'Updated', visible: false
@@ -15,6 +15,10 @@ class EffectiveAvailableApplicantReviewsDatatable < Effective::Datatable
15
15
  col :category, label: 'Category'
16
16
  col :to_status, label: 'Status'
17
17
 
18
+ col :flagged
19
+ col :flagged_at, visible: false
20
+ col :flagged_reason, visible: false
21
+
18
22
  col :reviews do |applicant|
19
23
  pluralize(applicant.applicant_reviews.count { |review| review.submitted? }, 'review')
20
24
  end
@@ -184,7 +184,7 @@ module Effective
184
184
  raise('expected a owner') unless owner.class.respond_to?(:effective_memberships_owner?)
185
185
 
186
186
  values = {
187
- name: owner.to_s,
187
+ name: owner.try(:email_to_s) || owner.to_s,
188
188
  email: owner.email
189
189
  }
190
190
 
@@ -195,7 +195,7 @@ module Effective
195
195
  raise('expected a owner') unless owner.class.respond_to?(:effective_memberships_owner?)
196
196
 
197
197
  values = {
198
- name: owner.to_s,
198
+ name: owner.try(:email_to_s) || owner.to_s,
199
199
  email: owner.email
200
200
  }
201
201
 
@@ -169,6 +169,11 @@ module EffectiveMembershipsApplicant
169
169
  missing_info_at :datetime
170
170
  missing_info_reason :text
171
171
 
172
+ # Flagged
173
+ flagged :boolean
174
+ flagged_at :datetime
175
+ flagged_reason :text
176
+
172
177
  # Applicant Educations
173
178
  applicant_educations_details :text
174
179
 
@@ -303,7 +308,7 @@ module EffectiveMembershipsApplicant
303
308
  x.errors.add(:end_on, "can't overlap when full time")
304
309
  y.errors.add(:start_on, "can't overlap when full time")
305
310
  y.errors.add(:end_on, "can't overlap when full time")
306
- self.errors.add(:applicant_experiences, "can't have overlaping dates for full time experiences")
311
+ self.errors.add(:applicant_experiences, "can't have overlapping dates for full time experiences")
307
312
  end
308
313
  end
309
314
  end
@@ -420,6 +425,13 @@ module EffectiveMembershipsApplicant
420
425
  # Admin Missing Info
421
426
  validates :missing_info_reason, presence: true, if: -> { missing_info? }
422
427
 
428
+ # Admin Flagged
429
+ validates :flagged_at, presence: true, if: -> { flagged? }
430
+ validates :flagged_reason, presence: true, if: -> { flagged? }
431
+
432
+ # Admin Unflagged
433
+ validates :flagged_at, absence: true, if: -> { !flagged? }
434
+
423
435
  # These two try completed and try reviewed
424
436
  # before_save(if: -> { submitted? }) { try_completed! }
425
437
  # before_save(if: -> { completed? }) { try_reviewed! }
@@ -832,7 +844,7 @@ module EffectiveMembershipsApplicant
832
844
  requirements['Transcripts'] = ('Not Required' unless transcripts_required?) || transcripts_received?
833
845
  end
834
846
 
835
- if all_steps.include?(:ensorsements) || applicant_endorsements_required?
847
+ if all_steps.include?(:endorsements) || applicant_endorsements_required?
836
848
  requirements['Endorsements'] = ('Not Required' unless applicant_endorsements_required?) || (applicant_endorsements.count(&:completed?) >= min_applicant_endorsements)
837
849
  end
838
850
 
@@ -1014,6 +1026,14 @@ module EffectiveMembershipsApplicant
1014
1026
  true
1015
1027
  end
1016
1028
 
1029
+ def flag!
1030
+ update!(flagged: true, flagged_at: Time.zone.now)
1031
+ end
1032
+
1033
+ def unflag!
1034
+ update!(flagged: false, flagged_at: nil)
1035
+ end
1036
+
1017
1037
  private
1018
1038
 
1019
1039
  def assign_applicant_experiences_months!
@@ -49,6 +49,8 @@ module EffectiveMembershipsApplicantReview
49
49
  scope :done, -> { where(status: :submitted) }
50
50
 
51
51
  belongs_to :applicant
52
+ accepts_nested_attributes_for :applicant
53
+
52
54
  belongs_to :reviewer, polymorphic: true
53
55
 
54
56
  effective_resource do
@@ -0,0 +1,7 @@
1
+ = effective_form_with(model: [:admin, applicant], engine: true) do |f|
2
+ %p This applicant will be marked as <strong>flagged</strong> with the following:
3
+
4
+ = f.hidden_field :flagged_at, value: Time.zone.now
5
+ = f.text_field :flagged_reason, required: true, label: 'Reason for flagging'
6
+
7
+ = f.submit 'Flag Applicant', border: false, center: true, 'data-confirm': "Flag #{f.object.owner}?"
@@ -1,9 +1,9 @@
1
+ %h5 Process applicant
2
+
1
3
  %p
2
4
  %span.badge.badge-secondary= applicant.status_label
3
5
  = applicant.summary
4
6
 
5
- %p Process applicant:
6
-
7
7
  = accordion do
8
8
  - if EffectiveResources.authorized?(self, :complete, applicant)
9
9
  = collapse 'Complete this Applicant' do
@@ -20,3 +20,23 @@
20
20
  - if EffectiveResources.authorized?(self, :decline, applicant)
21
21
  = collapse 'Decline this Applicant' do
22
22
  = render('admin/applicants/form_decline', applicant: applicant)
23
+
24
+ %h5.mt-3 Flag applicant
25
+
26
+ %p
27
+ - if applicant.flagged?
28
+ %small.text-muted This applicant was flagged at #{applicant.flagged_at.strftime('%B %d, %Y')} (#{time_ago_in_words(applicant.flagged_at)} ago) with reason: #{applicant.flagged_reason}
29
+ - else
30
+ %small.text-muted
31
+ This applicant is not currently flagged.
32
+ - if applicant.flagged_reason.present?
33
+ This applicant was previously flagged with reason: #{applicant.flagged_reason}
34
+
35
+ = accordion do
36
+ - if EffectiveResources.authorized?(self, :flag, applicant) && !applicant.flagged?
37
+ = collapse 'Flag this Applicant' do
38
+ = render('admin/applicants/form_flag', applicant: applicant)
39
+
40
+ - if EffectiveResources.authorized?(self, :unflag, applicant) && applicant.flagged?
41
+ = collapse 'Unflag this Applicant' do
42
+ = render('admin/applicants/form_unflag', applicant: applicant)
@@ -0,0 +1,7 @@
1
+ = effective_form_with(model: [:admin, applicant], engine: true) do |f|
2
+ %p This applicant will be marked as <strong>unflagged</strong>.
3
+
4
+ = f.hidden_field :flagged, value: false
5
+ = f.hidden_field :flagged_at, value: nil
6
+
7
+ = f.submit 'Unflag Applicant', border: false, center: true, 'data-confirm': "Unflag #{f.object.owner}?"
@@ -19,4 +19,12 @@
19
19
  = f.radios :recommendation, EffectiveMemberships.ApplicantReview.recommendations, label: false
20
20
  = f.text_area :comments, label: 'Reviewer comments'
21
21
 
22
+ - if EffectiveResources.authorized?(self, :flag, f.object.applicant)
23
+ = f.fields_for :applicant do |a|
24
+ = a.check_box :flagged, label: 'Flag this application'
25
+
26
+ = a.show_if :flagged, true do
27
+ = a.hidden_field :flagged_at, value: Time.zone.now
28
+ = a.text_area :flagged_reason, label: 'Reason for flagging'
29
+
22
30
  = f.save 'Submit Recommendation'
@@ -253,6 +253,11 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
253
253
  # Additional Information
254
254
  t.text :additional_information
255
255
 
256
+ # Flagged
257
+ t.boolean :flagged, default: false
258
+ t.datetime :flagged_at
259
+ t.text :flagged_reason
260
+
256
261
  t.datetime :updated_at
257
262
  t.datetime :created_at
258
263
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveMemberships
2
- VERSION = '0.17.11'
2
+ VERSION = '0.18.0'
3
3
  end
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.17.11
4
+ version: 0.18.0
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: 2023-06-27 00:00:00.000000000 Z
11
+ date: 2023-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -151,7 +151,7 @@ dependencies:
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
- name: haml-rails
154
+ name: haml
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - ">="
@@ -234,6 +234,20 @@ dependencies:
234
234
  - - ">="
235
235
  - !ruby/object:Gem::Version
236
236
  version: '0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: psych
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - "<"
242
+ - !ruby/object:Gem::Version
243
+ version: '4'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - "<"
249
+ - !ruby/object:Gem::Version
250
+ version: '4'
237
251
  description: Manage your professional association online. Membership categories, applications
238
252
  to join and reclassify, annual dues payments and more.
239
253
  email:
@@ -361,9 +375,11 @@ files:
361
375
  - app/views/admin/applicants/_form_approve.html.haml
362
376
  - app/views/admin/applicants/_form_complete.html.haml
363
377
  - app/views/admin/applicants/_form_decline.html.haml
378
+ - app/views/admin/applicants/_form_flag.html.haml
364
379
  - app/views/admin/applicants/_form_missing_info.html.haml
365
380
  - app/views/admin/applicants/_form_process.html.haml
366
381
  - app/views/admin/applicants/_form_transcripts.html.haml
382
+ - app/views/admin/applicants/_form_unflag.html.haml
367
383
  - app/views/admin/applicants/_status.html.haml
368
384
  - app/views/admin/categories/_fees_additional.html.haml
369
385
  - app/views/admin/categories/_fees_applicant.html.haml
@@ -577,7 +593,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
577
593
  - !ruby/object:Gem::Version
578
594
  version: '0'
579
595
  requirements: []
580
- rubygems_version: 3.4.10
596
+ rubygems_version: 3.3.7
581
597
  signing_key:
582
598
  specification_version: 4
583
599
  summary: Manage your professional association online. Membership categories, applications