effective_postmark 0.1.2 → 0.2.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: a50d0871b03f629a03dff786e0cddbfb4a84f05714e24e4d4a5391ae373735be
4
- data.tar.gz: e7453a8ce3aedbde5c5585710fe08a59097b80bdbda9855df0cb2eb981ee665f
3
+ metadata.gz: 4fe7f11d545296d6955abe9f0c934d791f64ebfae9fa6c648715b8e9b27e836b
4
+ data.tar.gz: a33fd5b23fbcb58730245be5201a8c1d965219f0e7c75116e79b0bdde57398a4
5
5
  SHA512:
6
- metadata.gz: 18875557e8e5ebe42f2e6df162ccf46035a39523878533a5c5fee6f3d04465dfb9a134f4dbd5dfd40525b4c3e7bde378aa09f059dc038cc8244b7a3e3e549a13
7
- data.tar.gz: a30e6ebfc8fbc396126e36deda1296e07dd4a222671ac4ec452cfef9efea6dce9875b3c796c8287dc2ab55071e6034fdcfdfdde2a982047070b6146ce8588637
6
+ metadata.gz: 7a25ef0fe93ca7217e03370437f062254212db1f1eec2837b295e758ba045e4bc2c92429671646900d426d066c6c65e12d4ec029d7ef3433e8c3be21d7fa9259
7
+ data.tar.gz: '0768ffeb2fb7b3f6f41d981418ce3206c6dcc63e827ab2f5f4e825c784427f9ec5adac8fa6528aaa7bad2066cbb3e688a4f204244c80a54096d235dc234d0975'
@@ -3,6 +3,8 @@ module Admin
3
3
  before_action(:authenticate_user!) if defined?(Devise)
4
4
  before_action { EffectiveResources.authorize!(self, :admin, :effective_postmark) }
5
5
 
6
+ include Effective::CrudController
7
+
6
8
  def inactive_recipients
7
9
  @datatable = Admin::ReportInactiveRecipientsDatatable.new
8
10
  @page_title = @datatable.datatable_name
@@ -1,7 +1,7 @@
1
1
  module EffectivePostmarkHelper
2
2
 
3
3
  # For use on the regular user alerts and forgot password pages
4
- def effective_postmark_alert(user, from: nil, html_class: 'alert alert-danger')
4
+ def effective_postmark_alert(user, from: nil, html_class: 'alert alert-danger mb-4')
5
5
  raise('expected an effective_postmark_user') unless user.class.try(:effective_postmark_user?)
6
6
  return unless user.postmark_invalid?
7
7
 
@@ -19,7 +19,7 @@ module EffectivePostmarkHelper
19
19
  end
20
20
 
21
21
  # For use on the admin/users#edit page
22
- def effective_postmark_admin_alert(user, from: nil, html_class: 'alert alert-danger')
22
+ def effective_postmark_admin_alert(user, from: nil, html_class: 'alert alert-danger mb-4')
23
23
  raise('expected an effective_postmark_user') unless user.class.try(:effective_postmark_user?)
24
24
  return unless user.postmark_invalid?
25
25
 
@@ -29,7 +29,7 @@ module EffectivePostmarkHelper
29
29
  "They will not receive any emails",
30
30
  ("from #{from}" if from),
31
31
  "while inactive.",
32
- "Please update their email address, or" +
32
+ "Please update their email address, or " +
33
33
  link_to('reactivate their email', effective_postmark.postmark_reactivate_admin_postmark_path(user), 'data-method': :post),
34
34
  "and automatically attempt an email delivery."
35
35
  ].compact.join(' ').html_safe
@@ -9,8 +9,23 @@ module EffectivePostmarkMailer
9
9
  end
10
10
  end
11
11
 
12
- rescue_from ::StandardError, with: :effective_postmark_error
13
- rescue_from ::Postmark::InactiveRecipientError, with: :effective_postmark_inactive_recipient_error
12
+ rescue_from(::StandardError, with: :effective_postmark_error) unless Rails.env.test? || Rails.env.development?
13
+ rescue_from(::Postmark::InactiveRecipientError, with: :effective_postmark_inactive_recipient_error)
14
+ end
15
+
16
+ module ClassMethods
17
+ def postmark_settings
18
+ tenant = if defined?(Tenant)
19
+ Tenant.current || raise("Missing tenant in effective_postmark postmark_settings")
20
+ end
21
+
22
+ api_token = EffectivePostmark.api_token.presence || begin
23
+ raise("Missing effective_postmark api_token for tenant :#{tenant}. Please see config/initializers/effective_postmark.rb") if tenant.present?
24
+ raise("Missing effective_postmark api_token. Please see config/initializers/effective_postmark.rb")
25
+ end
26
+
27
+ { api_token: api_token }
28
+ end
14
29
  end
15
30
 
16
31
  def effective_postmark_inactive_recipient_error(exception)
@@ -41,6 +56,9 @@ module EffectivePostmarkMailer
41
56
  end
42
57
 
43
58
  def effective_postmark_error(exception)
59
+ Rails.logger.info "\e[31m\e[1mEMAIL FAILED\e[0m\e[22m" # bold red
60
+ Rails.logger.info "#{exception.inspect}"
61
+
44
62
  true
45
63
  end
46
64
 
@@ -0,0 +1,4 @@
1
+ %h1.effective-admin-heading= @page_title
2
+
3
+ = card do
4
+ = render_datatable(@datatable)
@@ -4,13 +4,13 @@ EffectivePostmark.setup do |config|
4
4
  # config.layout = { application: 'application', admin: 'admin' }
5
5
 
6
6
  # API Key
7
- config.api_token = ENV.fetch('POSTMARK_API_TOKEN')
7
+ # config.api_token = ENV.fetch('POSTMARK_API_TOKEN')
8
8
 
9
9
  # Mailer Settings
10
10
  # Please see config/initializers/effective_resources.rb for default effective_* gem mailer settings
11
11
  #
12
12
  # Configure the class responsible to send e-mails.
13
- # config.mailer = 'Effective::ClassifiedsMailer'
13
+ # config.mailer = 'Effective::PostmarkMailer'
14
14
  #
15
15
  # Override effective_resource mailer defaults
16
16
  #
@@ -0,0 +1,8 @@
1
+ en:
2
+ effective_postmark:
3
+ name: 'Effective Postmark'
4
+ acronym: 'Postmark'
5
+
6
+ datatables:
7
+ admin/report_inactive_recipients_datatable: 'Report: Inactive Recipients'
8
+
@@ -1,3 +1,3 @@
1
1
  module EffectivePostmark
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_postmark
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.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-09-11 00:00:00.000000000 Z
11
+ date: 2024-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -219,14 +219,15 @@ files:
219
219
  - app/controllers/admin/postmark_controller.rb
220
220
  - app/controllers/admin/postmark_reports_controller.rb
221
221
  - app/datatables/admin/report_inactive_recipients_datatable.rb
222
- - app/datatables/effective_postmark_datatable.rb
223
222
  - app/helpers/effective_postmark_helper.rb
224
223
  - app/mailers/concerns/effective_postmark_mailer.rb
225
224
  - app/mailers/effective/postmark_mailer.rb
226
225
  - app/models/concerns/effective_postmark_user.rb
227
226
  - app/models/effective/postmark_api.rb
227
+ - app/views/admin/postmark_reports/index.html.haml
228
228
  - app/views/effective/postmark_mailer/reactivated.html.haml
229
229
  - config/effective_postmark.rb
230
+ - config/locales/effective_postmark.en.yml
230
231
  - config/routes.rb
231
232
  - db/migrate/101_create_effective_postmark.rb
232
233
  - db/seeds.rb
@@ -1,29 +0,0 @@
1
- class EffectivePostmarkDatatable < Effective::Datatable
2
- datatable do
3
- order :subject, :asc
4
- length :all
5
-
6
- col :updated_at, visible: false
7
- col :created_at, visible: false
8
- col :id, visible: false
9
-
10
- col :template_name, label: 'Name'
11
-
12
- col :from, search: EffectivePostmark.mailer_froms do |email_template|
13
- ERB::Util.html_escape_once(email_template.from)
14
- end
15
-
16
- col :cc
17
- col :bcc
18
- col :subject
19
- col :body
20
-
21
- col :content_type, visible: false
22
-
23
- actions_col
24
- end
25
-
26
- collection do
27
- Effective::EmailTemplate.all
28
- end
29
- end