effective_polls 0.6.3 → 0.7.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/datatables/admin/effective_poll_notifications_datatable.rb +8 -0
- data/app/models/concerns/effective_polls_user.rb +1 -0
- data/app/models/effective/poll_notification.rb +13 -9
- data/app/views/admin/poll_notifications/_form.html.haml +1 -20
- data/app/views/admin/polls/_form_poll.html.haml +1 -1
- data/db/migrate/101_create_effective_polls.rb +4 -0
- data/lib/effective_polls/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: 8f18ce3f4be236e848fdaf1f0cbc5964f1c7d0f4d1f89efcb0d4fd565b1d1d21
|
|
4
|
+
data.tar.gz: df60d1d96ad211ad97237165bcc366e1787dc03f3f938c1c4df7614184d34d6c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fbbad665eaaecdb8d975e63d44daa8846acedb2b601c5669c61d506b9fbf002e2b83cd9a6c3a5e3a8f26bd419c43cfb4280694dd6d36d9d04a61646090b4221f
|
|
7
|
+
data.tar.gz: 3bec1b83924572a0895ec8b3e499ad0d8ba590bbc58cf4bd429c22232fd9681d0f123d4bdd42e65776abfbd50c634b5185ed948ceffad948780c64741352319c
|
|
@@ -13,6 +13,10 @@ class Admin::EffectivePollNotificationsDatatable < Effective::Datatable
|
|
|
13
13
|
col :poll
|
|
14
14
|
col :category
|
|
15
15
|
|
|
16
|
+
col :from, visible: false do |notification|
|
|
17
|
+
ERB::Util.html_escape_once(notification.from)
|
|
18
|
+
end
|
|
19
|
+
|
|
16
20
|
col :reminder do |poll_notification|
|
|
17
21
|
case poll_notification.category
|
|
18
22
|
when 'When poll starts'
|
|
@@ -36,6 +40,10 @@ class Admin::EffectivePollNotificationsDatatable < Effective::Datatable
|
|
|
36
40
|
simple_format(notification.body.to_s)
|
|
37
41
|
end
|
|
38
42
|
|
|
43
|
+
col :cc, visible: false
|
|
44
|
+
col :bcc, visible: false
|
|
45
|
+
col :content_type, visible: false
|
|
46
|
+
|
|
39
47
|
col :started_at, visible: false
|
|
40
48
|
col :completed_at
|
|
41
49
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
module Effective
|
|
2
2
|
class PollNotification < ActiveRecord::Base
|
|
3
|
-
|
|
3
|
+
acts_as_email_notification # effective_resources
|
|
4
4
|
log_changes(to: :poll) if respond_to?(:log_changes)
|
|
5
5
|
|
|
6
|
+
belongs_to :poll
|
|
7
|
+
|
|
6
8
|
CATEGORIES = ['Upcoming reminder', 'When poll starts', 'Reminder', 'Before poll ends', 'When poll ends']
|
|
7
9
|
EMAIL_TEMPLATE_VARIABLES = ['available_date', 'title', 'url', 'user.name', 'user.email']
|
|
8
10
|
|
|
@@ -49,6 +51,10 @@ module Effective
|
|
|
49
51
|
subject :string
|
|
50
52
|
body :text
|
|
51
53
|
|
|
54
|
+
cc :string
|
|
55
|
+
bcc :string
|
|
56
|
+
content_type :string
|
|
57
|
+
|
|
52
58
|
# Tracking background jobs email send out
|
|
53
59
|
started_at :datetime
|
|
54
60
|
completed_at :datetime
|
|
@@ -68,13 +74,6 @@ module Effective
|
|
|
68
74
|
validates :poll, presence: true
|
|
69
75
|
validates :category, presence: true, inclusion: { in: CATEGORIES }
|
|
70
76
|
|
|
71
|
-
validates :from, presence: true
|
|
72
|
-
validates :subject, presence: true
|
|
73
|
-
validates :body, presence: true
|
|
74
|
-
|
|
75
|
-
validates :body, liquid: true
|
|
76
|
-
validates :subject, liquid: true
|
|
77
|
-
|
|
78
77
|
validates :reminder, if: -> { reminder? || upcoming_reminder? || before_poll_ends? },
|
|
79
78
|
presence: true, uniqueness: { scope: [:poll_id, :category], message: 'already exists' }
|
|
80
79
|
|
|
@@ -86,6 +85,10 @@ module Effective
|
|
|
86
85
|
'poll_' + category.to_s.parameterize.underscore
|
|
87
86
|
end
|
|
88
87
|
|
|
88
|
+
def email_template_variables
|
|
89
|
+
EMAIL_TEMPLATE_VARIABLES
|
|
90
|
+
end
|
|
91
|
+
|
|
89
92
|
def upcoming_reminder?
|
|
90
93
|
category == 'Upcoming reminder'
|
|
91
94
|
end
|
|
@@ -148,7 +151,8 @@ module Effective
|
|
|
148
151
|
Effective::PollsMailer.public_send(email_template, self, user).deliver_now
|
|
149
152
|
rescue => e
|
|
150
153
|
EffectiveLogger.error(e.message, associated: self) if defined?(EffectiveLogger)
|
|
151
|
-
ExceptionNotifier.notify_exception(e, data: { user_id: user.id }) if defined?(ExceptionNotifier)
|
|
154
|
+
ExceptionNotifier.notify_exception(e, data: { user_id: user.id, poll_notification_id: id }) if defined?(ExceptionNotifier)
|
|
155
|
+
raise(e) if Rails.env.test? || Rails.env.development?
|
|
152
156
|
end
|
|
153
157
|
|
|
154
158
|
end
|
|
@@ -13,25 +13,6 @@
|
|
|
13
13
|
|
|
14
14
|
= f.show_if :category, category do
|
|
15
15
|
.my-3= render "/admin/poll_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::PollNotification::EMAIL_TEMPLATE_VARIABLES.each do |variable|
|
|
33
|
-
%li {{ #{variable} }}
|
|
34
|
-
|
|
35
|
-
%small.text-muted Please contact us to add additional variables
|
|
16
|
+
= email_notification_fields(f, template, variables: Effective::PollNotification::EMAIL_TEMPLATE_VARIABLES)
|
|
36
17
|
|
|
37
18
|
= effective_submit(f)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
= f.datetime_field :end_at
|
|
7
7
|
|
|
8
8
|
- if f.object.poll_notifications.present?
|
|
9
|
-
.alert.alert-info
|
|
9
|
+
.alert.alert-info.mb-3
|
|
10
10
|
Please be aware of the existing #{ets(f.object.poll_notifications)} when changing the start or end availability date.
|
|
11
11
|
|
|
12
12
|
= f.check_box :hide_results,
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: effective_polls
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.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-
|
|
11
|
+
date: 2024-06-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|