nuntius 1.3.5 → 1.3.7

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: b0dd9ea6a32009f0a48a394de12275c119aa73c5dc72a4b21f749867b89797a1
4
- data.tar.gz: 01f2c695d6487875583d1e08f239beb110bf196dcc0820c13e48b97f7a6cef19
3
+ metadata.gz: 9b687606f90025f60156f83577dbc1b9d4d2edecdc70f84e497141ff37476965
4
+ data.tar.gz: 8f17f799c7d5c991bb8141cb29dd0e026651dc24993ab67e1fe5ed77f47aebfd
5
5
  SHA512:
6
- metadata.gz: 9c46fcdb21224720c3df7cc4d6c12a45a0a76a40d188a5f44bceafe75e56e476407d8e60d87bee00688010aea0385ac7dcd0c846efa04823caf60ec5251658de
7
- data.tar.gz: 1418023705add396e631737b239e4da268e3dc81d8bea01b5679520036868fb42da0f15a9f0632c9560a2d1da49aa65cbbc76e2b97d794752e0cbf5d3dfae6b2
6
+ metadata.gz: 27c5d73a3fc860ecb126e2967f75c8d985faf47af0900d59b704be4cf8a00821525344570e1bd611d92fa3ea33689ed1d0420c6edc46d9d69fa2aae58b3b605a
7
+ data.tar.gz: 1152e80c5e52d47adc53ac5519e328852874495534daf54b4e96491acd911bbdba9e0001f61b30a1491506432b3accd0bf49971487709ee36240d525c2a5026e
data/README.md CHANGED
@@ -165,6 +165,8 @@ The main key of the hash passed will also be the liquid variable.
165
165
 
166
166
  Outbound mail is handled through SMTP. We've only exposed the HTML of mail, we can create text-versions based on sanitized HTML. HTML allows for [Foundation for Emails](https://get.foundation/emails/docs/index.html). You will have to include the CSS in the layouts.
167
167
 
168
+ In the layout you can add `<a href="{{message_url}}">Link to mail</a>` to provide a link to the online version of the message.
169
+
168
170
  #### AWS SES
169
171
 
170
172
  In case you use AWS SES, you can use the SNS Feedback Notifications to automatically mark messages as read, or deal with complaints and bounces. Create a AWS SNS topic, with a HTTPS subscription with the following URL (pattern):
@@ -51,7 +51,7 @@ module Nuntius
51
51
  def campaign_params
52
52
  return unless params[:campaign]
53
53
 
54
- params.require(:campaign).permit(:name, :transport, :layout_id, :list_id, :from, :subject, :text, :html)
54
+ params.require(:campaign).permit(:name, :transport, :layout_id, :list_id, :from, :subject, :text, :html, :metadata_yaml)
55
55
  end
56
56
  end
57
57
  end
@@ -31,6 +31,11 @@ module Nuntius
31
31
  def update
32
32
  @layout = Nuntius::Layout.visible.find(params[:id])
33
33
  @layout.update(layout_params)
34
+ if params[:layout][:attachments].present?
35
+ params[:layout][:attachments].each do |attachment|
36
+ @layout.attachments.attach(attachment)
37
+ end
38
+ end
34
39
  respond_with :admin, @layout
35
40
  end
36
41
 
@@ -43,7 +48,8 @@ module Nuntius
43
48
  private
44
49
 
45
50
  def layout_params
46
- params.require(:layout).permit(:name, :data, :metadata_yaml, attachments: [])
51
+ permitted = %i[name data metadata_yaml]
52
+ params.require(:layout).permit(permitted)
47
53
  end
48
54
  end
49
55
  end
@@ -3,6 +3,9 @@
3
3
  module Nuntius
4
4
  class Campaign < ApplicationRecord
5
5
  include Nuntius::Concerns::MetadataScoped
6
+ include Nuntius::Concerns::Yamlify
7
+
8
+ yamlify :metadata
6
9
 
7
10
  belongs_to :list
8
11
  accepts_nested_attributes_for :list, reject_if: :all_blank
@@ -45,7 +45,7 @@ module Nuntius
45
45
  charset: "UTF-8"
46
46
  )
47
47
  if message.html.present?
48
- message.html = message.html.gsub("%7B%7Bmessage_url%7D%7D") { message_url(message) }
48
+ message.html = message.html.gsub("{{message_url}}") { message_url(message) }
49
49
  p.html_part = Mail::Part.new(
50
50
  body: message.html,
51
51
  content_type: "text/html",
@@ -84,7 +84,7 @@ module Nuntius
84
84
  private
85
85
 
86
86
  def message_url(message)
87
- Nuntius::Engine.routes.url_helpers.message_url(message.id, host: Nuntius.config.host.call(message))
87
+ Nuntius::Engine.routes.url_helpers.message_url(message.id, host: Nuntius.config.host(message))
88
88
  end
89
89
  end
90
90
  end
@@ -11,7 +11,7 @@ module Nuntius
11
11
 
12
12
  def perform
13
13
  deliver
14
- campaign.sent!
14
+ # campaign.sent!
15
15
  end
16
16
 
17
17
  def deliver
@@ -22,6 +22,7 @@ module Nuntius
22
22
  end
23
23
 
24
24
  def new_message(subscriber, assigns = {})
25
+ assigns["campaign"] = context.campaign
25
26
  assigns["subscriber"] = subscriber
26
27
  if subscriber.nuntiable
27
28
  name = Nuntius::BaseMessenger.liquid_variable_name_for(subscriber.nuntiable)
@@ -29,8 +30,11 @@ module Nuntius
29
30
  end
30
31
  message = Nuntius::Message.new(transport: campaign.transport, campaign: campaign, nuntiable: subscriber.nuntiable, metadata: campaign.metadata)
31
32
 
32
- locale_proc = Nuntius::BaseMessenger.messenger_for_obj(subscriber.nuntiable).locale
33
- locale = instance_exec(subscriber.nuntiable, &locale_proc) if subscriber.nuntiable && locale_proc
33
+ locale = nil
34
+ if subscriber.nuntiable
35
+ locale_proc = Nuntius::BaseMessenger.messenger_for_obj(subscriber.nuntiable).locale
36
+ locale = instance_exec(subscriber.nuntiable, &locale_proc) if locale_proc
37
+ end
34
38
 
35
39
  message.from = render(:from, assigns, locale)
36
40
  message.to = case campaign.transport
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nuntius
4
+ class CampaignMessagesTable < Nuntius::ApplicationTable
5
+ definition do
6
+ model Nuntius::Message
7
+
8
+ column(:to)
9
+ column(:status)
10
+ column(:created_at)
11
+
12
+ order created_at: :desc
13
+
14
+ link { |message| nuntius.admin_message_path(message) }
15
+ end
16
+
17
+ private
18
+
19
+ def scope
20
+ @scope = Nuntius::Campaign.find_by(params[:campaign_id]).messages
21
+ @scope
22
+ end
23
+ end
24
+ end
@@ -1,6 +1,8 @@
1
1
  - if @campaign.draft?
2
2
  = sts.form_for [:admin, @campaign] do |f|
3
3
  = sts.card :nuntius_admin_campaigns, icon: 'fal fa-megaphone' do |card|
4
+ - card.with_action
5
+ = f.continue
4
6
  - card.with_action
5
7
  = f.submit
6
8
 
@@ -25,21 +27,13 @@
25
27
  .col-span-12
26
28
  = f.input :subject
27
29
  .col-span-12
28
- = f.input :html, as: :hidden
29
- trix-editor input="campaign_html" style="background-color: #fff; height: 400px; margin-bottom: 20px;"
30
+ = f.rich_text :html
31
+ .col-span-12
32
+ = f.input :metadata_yaml, as: :editor, mode: 'application/yaml', label: t('.metadata')
30
33
 
31
34
  template data-toggle-target='toggleable' data-toggle-value='voice'
32
35
  .col-span-12
33
36
  = f.input :text, as: :editor, mode: 'text/plain'
34
37
  - else
35
- = sts.card :nuntius_admin_campaigns, title: @campaign.name, description: 'We are sending this campaign, you can no longer make any changes.', icon: 'fal fa-megaphone', content_padding: false do |card|
36
- table.table
37
- thead
38
- tr
39
- th Status
40
- th To
41
- tbody
42
- - for message in @messages
43
- tr
44
- td = link_to message.status, admin_message_path(message)
45
- td = message.to
38
+ = sts.card :nuntius_admin_campaigns, title: @campaign.name, description: 'We are sending or have sent this campaign, you can no longer make any changes.', icon: 'fal fa-megaphone', content_padding: false do |card|
39
+ = sts.table :"nuntius/campaign_messages", params: { campaign_id: @campaign.id }
@@ -1,5 +1,7 @@
1
1
  = sts.form_for([:admin, @layout]) do |f|
2
2
  = sts.card :nuntius_admin_layouts, icon: 'fal fa-table-layout' do |card|
3
+ - card.with_action
4
+ = f.continue
3
5
  - card.with_action
4
6
  = f.submit
5
7
 
@@ -30,10 +32,11 @@
30
32
  = (attachment.blob.byte_size / 1048576.0).round(2)
31
33
  ' MB
32
34
  = link_to admin_layout_attachment_path(@layout, attachment.id), data: { controller: 'attachment-delete', 'action': 'attachment-delete#delete' } do
33
- i.fal.fa-xmark
35
+ i.fas.fa-xmark
34
36
  =< link_to(main_app.rails_blob_path(attachment, disposition: 'attachment'),
35
37
  title: attachment.filename)
36
- i.fal.fa-download
38
+ i.fas.fa-download
39
+ code.text-xs = sts.copyable main_app.rails_blob_url(attachment)
37
40
 
38
41
  - if @layout.templates.exists?
39
42
  - card.with_tab :templates, padding: false
@@ -55,16 +55,16 @@
55
55
  .col-span-12
56
56
  = f.association :layout, collection: @layouts, include_blank: true
57
57
  .col-span-12
58
- = f.input :html, as: :editor, mode: 'text/markdown'
58
+ = f.input :html, as: :editor, mode: 'text/markdown', height: '400px'
59
59
 
60
60
  template data-toggle-target='toggleable' data-toggle-value='voice'
61
61
  .col-span-12
62
- = f.input :text, as: :editor, mode: 'text/plain'
62
+ = f.input :text, as: :editor, mode: 'text/plain', height: '400px'
63
63
  template data-toggle-target='toggleable' data-toggle-value='slack'
64
64
  .col-span-12
65
- = f.input :text, as: :editor, mode: 'text/plain'
65
+ = f.input :text, as: :editor, mode: 'text/plain', height: '400px'
66
66
  .col-span-12
67
- = f.input :payload, as: :editor, mode: 'application/yaml', hint: 'See here for more information: https://app.slack.com/block-kit-builder/'
67
+ = f.input :payload, as: :editor, mode: 'application/yaml', hint: 'See here for more information: https://app.slack.com/block-kit-builder/', height: '400px'
68
68
 
69
69
  template data-toggle-target='toggleable' data-toggle-value='sms'
70
70
  .col-span-12
@@ -72,7 +72,11 @@
72
72
  template data-toggle-target='toggleable' data-toggle-value='push'
73
73
  .col-span-12
74
74
  = f.input :text, as: :editor, mode: 'text/plain'
75
- template data-toggle-target='toggleable' data-toggle-value='slack'
75
+ template data-toggle-target='toggleable' data-toggle-value='teams'
76
+ .col-span-12
77
+ = f.input :text, as: :editor, mode: 'text/plain', height: '400px'
78
+ .col-span-12
79
+ = f.input :payload, as: :editor, mode: 'application/yaml', hint: 'See here for more information: https://www.adaptivecards.io/designer/', height: '400px'
76
80
 
77
81
 
78
82
  - if @template.messages.exists?
@@ -55,6 +55,7 @@ en:
55
55
  card:
56
56
  nuntius_admin_campaigns:
57
57
  title: Campaigns
58
+ metadata: Metadata
58
59
  index:
59
60
  card:
60
61
  nuntius_admin_campaigns:
@@ -55,6 +55,7 @@ nl:
55
55
  card:
56
56
  nuntius_admin_campaigns:
57
57
  title: Campagne
58
+ metadata: Metadata
58
59
  index:
59
60
  card:
60
61
  nuntius_admin_campaigns:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nuntius
4
- VERSION = "1.3.5"
4
+ VERSION = "1.3.7"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nuntius
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 1.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom de Grunt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-26 00:00:00.000000000 Z
11
+ date: 2024-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apnotic
@@ -497,6 +497,7 @@ files:
497
497
  - app/services/nuntius/deliver_inbound_message_service.rb
498
498
  - app/services/nuntius/retrieve_inbound_mail_service.rb
499
499
  - app/tables/nuntius/application_table.rb
500
+ - app/tables/nuntius/campaign_messages_table.rb
500
501
  - app/tables/nuntius/campaigns_table.rb
501
502
  - app/tables/nuntius/layouts_table.rb
502
503
  - app/tables/nuntius/lists_table.rb