effective_polls 0.6.3 → 0.7.0
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_poll_notifications_datatable.rb +8 -0
- data/app/models/concerns/effective_polls_user.rb +1 -0
- data/app/models/effective/poll_notification.rb +9 -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: ca8b66afdebdcb7535e1187b1b26df25ed0adfd902aabf6055a883da82310d20
|
4
|
+
data.tar.gz: 2589e57b66dce9dbc23ba2b5cdbe5f12d275acd24f8229cab3f80d2c2e7aa913
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16ba5035844798e847132f3a3b7aa109758cf666fc0ca9a13d3d96a73d1be69d668c8ad21433e82d7393eba16ae8f2b89f0252eee9761a88f95b92d9bf9cce21
|
7
|
+
data.tar.gz: 59daa63060a34e1217724ce38b8439e84b1ee5e76361a4edd50d02f15ba6f4a9dea9744538f1fad96309a5ad5a63b70b5142a90beba816148168215d68e9750f
|
@@ -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
|
|
@@ -148,7 +147,8 @@ module Effective
|
|
148
147
|
Effective::PollsMailer.public_send(email_template, self, user).deliver_now
|
149
148
|
rescue => e
|
150
149
|
EffectiveLogger.error(e.message, associated: self) if defined?(EffectiveLogger)
|
151
|
-
ExceptionNotifier.notify_exception(e, data: { user_id: user.id }) if defined?(ExceptionNotifier)
|
150
|
+
ExceptionNotifier.notify_exception(e, data: { user_id: user.id, poll_notification_id: id }) if defined?(ExceptionNotifier)
|
151
|
+
raise(e) if Rails.env.test? || Rails.env.development?
|
152
152
|
end
|
153
153
|
|
154
154
|
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.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-
|
11
|
+
date: 2024-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|