effective_events 0.14.2 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/datatables/admin/effective_event_notifications_datatable.rb +10 -3
- data/app/models/effective/event_notification.rb +16 -10
- data/app/views/admin/event_notifications/_form.html.haml +2 -21
- data/db/migrate/101_create_effective_events.rb +4 -0
- data/lib/effective_events/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: dd768661ad3e89bba50c413474a8694263ff5aa2262e9738ad78ac084089df38
|
4
|
+
data.tar.gz: 7eb9a1b2731464398a4fecc6a0435f94cd6718de3be594b07c88546be4e4ec9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a554cde3edc18545fda120d05dee465f2ceda1b9d1ceb6da2a8d7786a4b1850d77ebf4b468f355f353afb8a0bf14b4eb51eaf505af5ccb8381ccd49999091270
|
7
|
+
data.tar.gz: 63711c311814d5c9926be5651f14367f5c00e9adaeeaa7dcd8ce2542b8adc027c32dc27b77bc062dcc981e1901281fb9bd9205944f92755e5f177cf6827ca955
|
@@ -12,7 +12,10 @@ class Admin::EffectiveEventNotificationsDatatable < Effective::Datatable
|
|
12
12
|
|
13
13
|
col :event
|
14
14
|
col :category
|
15
|
-
|
15
|
+
|
16
|
+
col :from, visible: false do |notification|
|
17
|
+
ERB::Util.html_escape_once(notification.from)
|
18
|
+
end
|
16
19
|
|
17
20
|
# col :reminder do |poll_notification|
|
18
21
|
# case poll_notification.category
|
@@ -37,8 +40,12 @@ class Admin::EffectiveEventNotificationsDatatable < Effective::Datatable
|
|
37
40
|
simple_format(notification.body)
|
38
41
|
end
|
39
42
|
|
40
|
-
|
41
|
-
|
43
|
+
col :cc, visible: false
|
44
|
+
col :bcc, visible: false
|
45
|
+
col :content_type, visible: false
|
46
|
+
|
47
|
+
col :started_at, visible: false
|
48
|
+
col :completed_at
|
42
49
|
|
43
50
|
actions_col
|
44
51
|
end
|
@@ -2,6 +2,7 @@ module Effective
|
|
2
2
|
class EventNotification < ActiveRecord::Base
|
3
3
|
self.table_name = (EffectiveEvents.event_notifications_table_name || :event_notifications).to_s
|
4
4
|
|
5
|
+
acts_as_email_notification # effective_resources
|
5
6
|
log_changes(to: :event) if respond_to?(:log_changes)
|
6
7
|
|
7
8
|
belongs_to :event
|
@@ -54,6 +55,10 @@ module Effective
|
|
54
55
|
subject :string
|
55
56
|
body :text
|
56
57
|
|
58
|
+
cc :string
|
59
|
+
bcc :string
|
60
|
+
content_type :string
|
61
|
+
|
57
62
|
# Tracking background jobs email send out
|
58
63
|
started_at :datetime
|
59
64
|
completed_at :datetime
|
@@ -72,13 +77,6 @@ module Effective
|
|
72
77
|
|
73
78
|
validates :category, presence: true, inclusion: { in: CATEGORIES }
|
74
79
|
|
75
|
-
validates :from, presence: true, email: true
|
76
|
-
validates :subject, presence: true
|
77
|
-
validates :body, presence: true
|
78
|
-
|
79
|
-
validates :body, liquid: true
|
80
|
-
validates :subject, liquid: true
|
81
|
-
|
82
80
|
# validates :reminder, if: -> { reminder? || upcoming_reminder? || before_event_ends? },
|
83
81
|
# presence: true, uniqueness: { scope: [:event_id, :category], message: 'already exists' }
|
84
82
|
|
@@ -90,6 +88,10 @@ module Effective
|
|
90
88
|
'event_' + category.to_s.parameterize.underscore
|
91
89
|
end
|
92
90
|
|
91
|
+
def email_template_variables
|
92
|
+
EMAIL_TEMPLATE_VARIABLES
|
93
|
+
end
|
94
|
+
|
93
95
|
def registrant_purchased?
|
94
96
|
category == 'Registrant purchased'
|
95
97
|
end
|
@@ -147,10 +149,14 @@ module Effective
|
|
147
149
|
|
148
150
|
update_column(:started_at, Time.zone.now)
|
149
151
|
|
150
|
-
opts = { from: from, subject: subject, body: body }
|
151
|
-
|
152
152
|
event_registrants.each do |event_registrant|
|
153
|
-
|
153
|
+
begin
|
154
|
+
EffectiveEvents.send_email(email_template, event_registrant, email_notification_params)
|
155
|
+
rescue => e
|
156
|
+
EffectiveLogger.error(e.message, associated: event_registrant) if defined?(EffectiveLogger)
|
157
|
+
ExceptionNotifier.notify_exception(e, data: { event_registrant_id: event_registrant.id, event_notification_id: id }) if defined?(ExceptionNotifier)
|
158
|
+
raise(e) if Rails.env.test? || Rails.env.development?
|
159
|
+
end
|
154
160
|
end
|
155
161
|
|
156
162
|
update_column(:completed_at, Time.zone.now)
|
@@ -12,26 +12,7 @@
|
|
12
12
|
- template = 'event_' + category.parameterize.underscore
|
13
13
|
|
14
14
|
= f.show_if :category, category do
|
15
|
-
= render "/admin/event_notifications/form_#{template}", f: f
|
16
|
-
|
17
|
-
- if f.object.category == category && f.object.persisted?
|
18
|
-
= f.select :from, mailer_froms_collection(), label: 'From'
|
19
|
-
= f.text_field :subject
|
20
|
-
= f.text_area :body, rows: 10
|
21
|
-
- else
|
22
|
-
- email_template = Effective::EmailTemplate.where(template_name: template).first!
|
23
|
-
- from_value = email_template.from || EffectiveResources.mailer_froms.first
|
24
|
-
|
25
|
-
= f.select :from, mailer_froms_collection(), label: 'From', value: from_value
|
26
|
-
= f.text_field :subject, value: email_template.subject
|
27
|
-
= f.text_area :body, rows: 10, value: email_template.body
|
28
|
-
|
29
|
-
%p The available variables are:
|
30
|
-
|
31
|
-
%ul
|
32
|
-
- Effective::EventNotification::EMAIL_TEMPLATE_VARIABLES.each do |variable|
|
33
|
-
%li {{ #{variable} }}
|
34
|
-
|
35
|
-
%small.text-muted Please contact us to add additional variables
|
15
|
+
.my-3= render "/admin/event_notifications/form_#{template}", f: f
|
16
|
+
= email_notification_fields(f, template, variables: Effective::EventNotification::EMAIL_TEMPLATE_VARIABLES)
|
36
17
|
|
37
18
|
= effective_submit(f)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_events
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.1
|
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: 2024-06-
|
11
|
+
date: 2024-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|