nuntius 1.3.6 → 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: 11b30e0625c1b47a70a22803a0bdec45d92faf881b1e83ae72e00582d95b36f4
4
- data.tar.gz: ec9251af770d4b3cd4ae58b75968bddc4e4917dc1ba01d8073eb73df56c9fe4e
3
+ metadata.gz: 9b687606f90025f60156f83577dbc1b9d4d2edecdc70f84e497141ff37476965
4
+ data.tar.gz: 8f17f799c7d5c991bb8141cb29dd0e026651dc24993ab67e1fe5ed77f47aebfd
5
5
  SHA512:
6
- metadata.gz: a8dd4831dcbb7c4e8440e4a1ebf281a712959de7a47323e2590a24d71bf039c5a7c7b5899e3427832949a061f1bed2ac72b3f70acdc86b534aafe16f7d364689
7
- data.tar.gz: 1c5e6ad9964622533dad4c91df0ff7bcdf05299bbaddcdf81efcfee6eeea02f9b50bc7ad662b174e8433e422d040dda57b8e9f627fd2c8360cc27575653735c8
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
 
@@ -44,7 +49,6 @@ module Nuntius
44
49
 
45
50
  def layout_params
46
51
  permitted = %i[name data metadata_yaml]
47
- permitted += [attachments: []] if params[:layout][:attachments].compact_blank.present?
48
52
  params.require(:layout).permit(permitted)
49
53
  end
50
54
  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
@@ -27,21 +27,13 @@
27
27
  .col-span-12
28
28
  = f.input :subject
29
29
  .col-span-12
30
- = f.input :html, as: :hidden
31
- 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')
32
33
 
33
34
  template data-toggle-target='toggleable' data-toggle-value='voice'
34
35
  .col-span-12
35
36
  = f.input :text, as: :editor, mode: 'text/plain'
36
37
  - else
37
- = 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|
38
- table.table
39
- thead
40
- tr
41
- th Status
42
- th To
43
- tbody
44
- - for message in @messages
45
- tr
46
- td = link_to message.status, admin_message_path(message)
47
- 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 }
@@ -32,10 +32,11 @@
32
32
  = (attachment.blob.byte_size / 1048576.0).round(2)
33
33
  ' MB
34
34
  = link_to admin_layout_attachment_path(@layout, attachment.id), data: { controller: 'attachment-delete', 'action': 'attachment-delete#delete' } do
35
- i.fal.fa-xmark
35
+ i.fas.fa-xmark
36
36
  =< link_to(main_app.rails_blob_path(attachment, disposition: 'attachment'),
37
37
  title: attachment.filename)
38
- i.fal.fa-download
38
+ i.fas.fa-download
39
+ code.text-xs = sts.copyable main_app.rails_blob_url(attachment)
39
40
 
40
41
  - if @layout.templates.exists?
41
42
  - card.with_tab :templates, padding: false
@@ -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.6"
4
+ VERSION = "1.3.7"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nuntius
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.6
4
+ version: 1.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom de Grunt
@@ -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