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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2bafebbeefa08903464ef6e454ab803b59127f8e4829f9c3a3c50d359f4d7c01
4
- data.tar.gz: 173d9fb9055272c97429e3032753574ef620918917e583a1a4c7d1c6d9be79a1
3
+ metadata.gz: dd768661ad3e89bba50c413474a8694263ff5aa2262e9738ad78ac084089df38
4
+ data.tar.gz: 7eb9a1b2731464398a4fecc6a0435f94cd6718de3be594b07c88546be4e4ec9c
5
5
  SHA512:
6
- metadata.gz: cbf802ac66fc1f8e44d579e1907f82bde8d88f4b686f6b276a2430cf56f80fa3e2f8719d0076b1a09cd791a56f194d672e0221e5a419e39a4a7eeed7f1a3e06d
7
- data.tar.gz: ec6b5dc089d187623dfacb7738f230020f68d6e3213120f8ee7992f1567ba802aed31ec1ed8fa71adace33a4f4912c584f9e4514c34061978f2123026845d97a
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
- col :from
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
- # col :started_at, visible: false
41
- # col :completed_at
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
- EffectiveEvents.send_email(email_template, event_registrant, opts)
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)
@@ -183,6 +183,10 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
183
183
  t.string :subject
184
184
  t.text :body
185
185
 
186
+ t.string :cc
187
+ t.string :bcc
188
+ t.string :content_type
189
+
186
190
  t.datetime :started_at
187
191
  t.datetime :completed_at
188
192
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveEvents
2
- VERSION = '0.14.2'.freeze
2
+ VERSION = '0.15.1'.freeze
3
3
  end
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.14.2
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-13 00:00:00.000000000 Z
11
+ date: 2024-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails