effective_polls 0.6.3 → 0.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a20ad391dc3c9332c540ddf58f76004950099c17f9305af1919c7f541251019
4
- data.tar.gz: b6c5b6688300174b7f836b5572707006cc08b81e6c50bf131ca6127fedb48342
3
+ metadata.gz: ca8b66afdebdcb7535e1187b1b26df25ed0adfd902aabf6055a883da82310d20
4
+ data.tar.gz: 2589e57b66dce9dbc23ba2b5cdbe5f12d275acd24f8229cab3f80d2c2e7aa913
5
5
  SHA512:
6
- metadata.gz: 2b624b1d4005ea65626a2d82fe33bff3640f4696670a8575f7c3aced34506e0b8fb21c8cfd201ffcdd5e72d1da4b7d2a50cbc5d0ee7f802fe0b3089e1fa24feb
7
- data.tar.gz: 7b1b714ceafa0e11c52ded569ac091ca32b045a5d9fd2f5f6c1bd7915d6ba8baf3532f400a2588b040eb8ceb28470158c1a886198eb5851bc1e120da6ef1f2ae
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
 
@@ -21,6 +21,7 @@ module EffectivePollsUser
21
21
 
22
22
  # The list of all available audience scopes for the Poll Selected Users
23
23
  def poll_audience_scopes
24
+ default_poll_audience_scopes()
24
25
  end
25
26
 
26
27
  def default_poll_audience_scopes
@@ -1,8 +1,10 @@
1
1
  module Effective
2
2
  class PollNotification < ActiveRecord::Base
3
- belongs_to :poll
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,
@@ -29,6 +29,10 @@ class CreateEffectivePolls < ActiveRecord::Migration[6.0]
29
29
  t.string :subject
30
30
  t.text :body
31
31
 
32
+ t.string :cc
33
+ t.string :bcc
34
+ t.string :content_type
35
+
32
36
  t.datetime :started_at
33
37
  t.datetime :completed_at
34
38
 
@@ -1,3 +1,3 @@
1
1
  module EffectivePolls
2
- VERSION = '0.6.3'
2
+ VERSION = '0.7.0'
3
3
  end
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.6.3
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-05-22 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