effective_events 0.14.2 → 0.15.0

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: aeed000b9c4ccbe02f6fcc29eb381caf0612cb8c7caa35155e3b122299dcddd9
4
+ data.tar.gz: d4556b21e76cdb1484a315d4f9b74cdaea405f9fc569c0794b1f0946d8c6a54f
5
5
  SHA512:
6
- metadata.gz: cbf802ac66fc1f8e44d579e1907f82bde8d88f4b686f6b276a2430cf56f80fa3e2f8719d0076b1a09cd791a56f194d672e0221e5a419e39a4a7eeed7f1a3e06d
7
- data.tar.gz: ec6b5dc089d187623dfacb7738f230020f68d6e3213120f8ee7992f1567ba802aed31ec1ed8fa71adace33a4f4912c584f9e4514c34061978f2123026845d97a
6
+ metadata.gz: a744ca3b393c87820ed2aa100bf9ea01e92d41688cbbd6c84412d5eafae3f74d8e3ea7af7900f45e7e6f810f47b51f34e6335a89983a39100948fdba21a2db32
7
+ data.tar.gz: e9f1bbe0bc3931f7f41c761eb502f50913259bb2f7dd22b315573d7c7c5e92fcf8b6260de7e631f36e9ab0f9ea6797a1687ae8c96fed065b6076bce7a0ef0337
@@ -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
 
@@ -147,10 +145,14 @@ module Effective
147
145
 
148
146
  update_column(:started_at, Time.zone.now)
149
147
 
150
- opts = { from: from, subject: subject, body: body }
151
-
152
148
  event_registrants.each do |event_registrant|
153
- EffectiveEvents.send_email(email_template, event_registrant, opts)
149
+ begin
150
+ EffectiveEvents.send_email(email_template, event_registrant, email_notification_params)
151
+ rescue => e
152
+ EffectiveLogger.error(e.message, associated: event_registrant) if defined?(EffectiveLogger)
153
+ ExceptionNotifier.notify_exception(e, data: { event_registrant_id: event_registrant.id, event_notification_id: id }) if defined?(ExceptionNotifier)
154
+ raise(e) if Rails.env.test? || Rails.env.development?
155
+ end
154
156
  end
155
157
 
156
158
  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.0'.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.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: 2024-06-13 00:00:00.000000000 Z
11
+ date: 2024-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails