nuntius 1.0.27 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +77 -18
  3. data/Rakefile +16 -39
  4. data/app/controllers/nuntius/admin/campaigns_controller.rb +12 -10
  5. data/app/controllers/nuntius/admin/layouts/attachments_controller.rb +2 -1
  6. data/app/controllers/nuntius/admin/layouts_controller.rb +1 -1
  7. data/app/controllers/nuntius/admin/lists/subscribers_controller.rb +1 -1
  8. data/app/controllers/nuntius/admin/lists_controller.rb +4 -4
  9. data/app/controllers/nuntius/admin/locales_controller.rb +3 -2
  10. data/app/controllers/nuntius/admin/messages_controller.rb +2 -2
  11. data/app/controllers/nuntius/admin/templates_controller.rb +1 -1
  12. data/app/controllers/nuntius/api/events_controller.rb +2 -2
  13. data/app/controllers/nuntius/application_admin_controller.rb +1 -1
  14. data/app/controllers/nuntius/callbacks_controller.rb +4 -4
  15. data/app/controllers/nuntius/dashboard_controller.rb +1 -1
  16. data/app/controllers/nuntius/feedback_controller.rb +1 -2
  17. data/app/controllers/nuntius/inbound_messages/twilio_inbound_smses_controller.rb +7 -7
  18. data/app/controllers/nuntius/messages_controller.rb +1 -1
  19. data/app/controllers/nuntius/subscribers_controller.rb +33 -0
  20. data/app/drops/nuntius/list_drop.rb +7 -0
  21. data/app/drops/nuntius/subscriber_drop.rb +7 -0
  22. data/app/exceptions/nuntius/base_exception.rb +2 -0
  23. data/app/exceptions/nuntius/missing_messenger_exception.rb +2 -0
  24. data/app/helpers/nuntius/application_helper.rb +6 -11
  25. data/app/jobs/nuntius/deliver_inbound_message_job.rb +1 -1
  26. data/app/jobs/nuntius/purge_message_job.rb +2 -2
  27. data/app/jobs/nuntius/retrieve_mail_job.rb +2 -2
  28. data/app/jobs/nuntius/transport_delivery_job.rb +2 -2
  29. data/app/message_boxes/nuntius/base_message_box.rb +46 -23
  30. data/app/messengers/nuntius/base_messenger.rb +13 -12
  31. data/app/models/nuntius/application_record.rb +1 -1
  32. data/app/models/nuntius/attachment.rb +4 -2
  33. data/app/models/nuntius/campaign.rb +4 -51
  34. data/app/models/nuntius/concerns/yamlify.rb +2 -2
  35. data/app/models/nuntius/inbound_message.rb +2 -0
  36. data/app/models/nuntius/list.rb +11 -1
  37. data/app/models/nuntius/message.rb +34 -29
  38. data/app/models/nuntius/subscriber.rb +21 -1
  39. data/app/models/nuntius/template.rb +20 -20
  40. data/app/presenters/application_presenter.rb +1 -1
  41. data/app/presenters/template_presenter.rb +3 -3
  42. data/app/providers/nuntius/apnotic_push_provider.rb +17 -17
  43. data/app/providers/nuntius/base_provider.rb +6 -6
  44. data/app/providers/nuntius/firebase_push_provider.rb +8 -8
  45. data/app/providers/nuntius/houston_push_provider.rb +15 -15
  46. data/app/providers/nuntius/message_bird_sms_provider.rb +7 -7
  47. data/app/providers/nuntius/slack_slack_provider.rb +7 -7
  48. data/app/providers/nuntius/smtp_mail_provider.rb +36 -28
  49. data/app/providers/nuntius/teams_teams_provider.rb +24 -0
  50. data/app/providers/nuntius/twilio_sms_provider.rb +4 -4
  51. data/app/providers/nuntius/twilio_voice_provider.rb +13 -13
  52. data/app/services/nuntius/aws_sns_processor_service.rb +11 -11
  53. data/app/services/nuntius/deliver_campaign_service.rb +65 -0
  54. data/app/services/nuntius/deliver_inbound_message_service.rb +3 -2
  55. data/app/services/nuntius/retrieve_inbound_mail_service.rb +23 -16
  56. data/app/tables/nuntius_campaigns_table.rb +10 -1
  57. data/app/tables/nuntius_layouts_table.rb +4 -4
  58. data/app/tables/nuntius_lists_table.rb +1 -1
  59. data/app/tables/nuntius_locales_table.rb +1 -1
  60. data/app/tables/nuntius_messages_table.rb +5 -5
  61. data/app/tables/nuntius_subscribers_table.rb +3 -2
  62. data/app/tables/nuntius_templates_table.rb +12 -5
  63. data/app/transports/nuntius/base_transport.rb +1 -1
  64. data/app/transports/nuntius/mail_transport.rb +1 -1
  65. data/app/transports/nuntius/push_transport.rb +1 -1
  66. data/app/transports/nuntius/teams_transport.rb +6 -0
  67. data/app/views/nuntius/admin/campaigns/edit.html.slim +12 -16
  68. data/app/views/nuntius/admin/campaigns/index.html.slim +2 -2
  69. data/app/views/nuntius/admin/layouts/attachments/create.json.jbuilder +3 -3
  70. data/app/views/nuntius/admin/layouts/edit.html.slim +18 -19
  71. data/app/views/nuntius/admin/layouts/index.html.slim +2 -2
  72. data/app/views/nuntius/admin/lists/edit.html.slim +19 -9
  73. data/app/views/nuntius/admin/lists/index.html.slim +2 -2
  74. data/app/views/nuntius/admin/lists/subscribers/edit.html.slim +2 -2
  75. data/app/views/nuntius/admin/locales/edit.html.slim +3 -3
  76. data/app/views/nuntius/admin/locales/index.html.slim +2 -2
  77. data/app/views/nuntius/admin/messages/index.html.slim +2 -2
  78. data/app/views/nuntius/admin/messages/show.html.slim +12 -12
  79. data/app/views/nuntius/admin/templates/edit.html.slim +62 -64
  80. data/app/views/nuntius/admin/templates/index.html.slim +2 -2
  81. data/app/views/nuntius/dashboard/show.html.slim +2 -6
  82. data/app/views/nuntius/subscribers/show.html.slim +9 -0
  83. data/config/locales/en.yml +97 -1
  84. data/config/routes.rb +18 -8
  85. data/db/migrate/20190301201541_create_nuntius_templates.rb +5 -5
  86. data/db/migrate/20190301202436_create_nuntius_messages.rb +4 -4
  87. data/db/migrate/20190322114340_create_nuntius_campaigns.rb +2 -2
  88. data/db/migrate/20190322121338_create_nuntius_subscribers.rb +1 -1
  89. data/db/migrate/20190327124407_create_nuntius_layouts.rb +5 -5
  90. data/db/migrate/20190327143921_add_campaign_to_message.rb +1 -1
  91. data/db/migrate/20190417125153_change_message_status_default.rb +2 -2
  92. data/db/migrate/20190825080757_update_nuntius_message_sending_to_sent.rb +2 -2
  93. data/db/migrate/20200220154927_change_nuntius_templates_payload_type.rb +1 -1
  94. data/db/migrate/20200318095339_create_nuntius_attachments.rb +2 -2
  95. data/db/migrate/20201121185718_create_nuntius_inbound_messages.rb +1 -1
  96. data/db/migrate/20240205204719_add_description_to_list.rb +5 -0
  97. data/db/migrate/20240206203019_add_slug_to_nuntius_list.rb +9 -0
  98. data/lib/nuntius/active_record_helpers.rb +4 -4
  99. data/lib/nuntius/configuration.rb +64 -27
  100. data/lib/nuntius/deprecator.rb +2 -0
  101. data/lib/nuntius/devise.rb +1 -1
  102. data/lib/nuntius/engine.rb +13 -27
  103. data/lib/nuntius/i18n_store.rb +6 -5
  104. data/lib/nuntius/liquid/tags/attach_tag.rb +11 -11
  105. data/lib/nuntius/mail_allow_list.rb +2 -2
  106. data/lib/nuntius/nuntiable.rb +3 -1
  107. data/lib/nuntius/transactio.rb +1 -1
  108. data/lib/nuntius/version.rb +1 -1
  109. data/lib/nuntius.rb +13 -27
  110. data/lib/preamble.rb +18 -18
  111. data/lib/tasks/nuntius_tasks.rake +4 -4
  112. metadata +48 -33
  113. data/app/jobs/nuntius/process_inbound_message_job.rb +0 -10
  114. data/app/reportlets/nuntius/application_reportlet.rb +0 -35
  115. data/app/reportlets/nuntius/daily_messages_per_template_reportlet.rb +0 -50
  116. data/config/webpack/development.js +0 -5
  117. data/config/webpack/environment.js +0 -4
  118. data/config/webpack/production.js +0 -5
  119. data/config/webpack/test.js +0 -5
  120. data/config/webpacker.yml +0 -119
@@ -3,12 +3,12 @@
3
3
  class NuntiusLayoutsTable < ActionTable::ActionTable
4
4
  model Nuntius::Layout
5
5
 
6
- column(:name) { |layout| layout.name }
6
+ column(:name)
7
7
  column(:metadata) { |layout| Nuntius.config.metadata_humanize(layout.metadata) }
8
8
 
9
- column :actions, title: '', sortable: false do |layout|
10
- content_tag(:span, class: 'btn-group btn-group-xs') do
11
- concat link_to(content_tag(:i, nil, class: 'fa fa-trash'), nuntius.admin_layout_url(layout), data: { turbo_confirm: 'Are you sure you want to delete the layout?', turbo_method: :delete }, class: 'btn btn-xs btn-danger')
9
+ column :actions, title: "", sortable: false do |layout|
10
+ content_tag(:span, class: "btn-group btn-group-xs") do
11
+ concat link_to(content_tag(:i, nil, class: "fa fa-trash"), nuntius.admin_layout_url(layout), data: {turbo_confirm: "Are you sure you want to delete the layout?", turbo_method: :delete}, class: "btn btn-xs btn-danger")
12
12
  end
13
13
  end
14
14
 
@@ -5,7 +5,7 @@ class NuntiusListsTable < ActionTable::ActionTable
5
5
 
6
6
  column(:name)
7
7
  column(:metadata) { |list| Nuntius.config.metadata_humanize(list.metadata) }
8
- column(:subscribers) { |list| list.subscribers.count || '-' }
8
+ column(:subscribers, sort_field: "subscribers_count") { |list| list.subscribers.count || "-" }
9
9
 
10
10
  initial_order :name, :asc
11
11
 
@@ -6,7 +6,7 @@ class NuntiusLocalesTable < ActionTable::ActionTable
6
6
  column(:key)
7
7
  column(:metadata) { |locale| Nuntius.config.metadata_humanize(locale.metadata) }
8
8
 
9
- initial_order :mkey, :asc
9
+ initial_order :key
10
10
 
11
11
  row_link { |locale| nuntius.edit_admin_locale_path(locale) }
12
12
 
@@ -4,9 +4,9 @@ class NuntiusMessagesTable < ActionTable::ActionTable
4
4
  model Nuntius::Message
5
5
 
6
6
  column(:to)
7
- column(:created_at) { |message| ln(message.created_at) }
8
- column(:last_sent_at) { |message| ln(message.last_sent_at) }
9
- column(:origin) do |message|
7
+ column(:created_at, html_value: proc { |message| ln(message.created_at) })
8
+ column(:last_sent_at, html_value: proc { |message| ln(message.last_sent_at) })
9
+ column(:origin, sort_field: "nuntius_messages.campaign_id, nuntius_messages.template_id") do |message|
10
10
  link_to message.campaign&.name, nuntius.edit_admin_campaign_path(message.campaign) if message.campaign
11
11
  link_to message.template&.description, nuntius.edit_admin_template_path(message.template) if message.template
12
12
  end
@@ -14,8 +14,8 @@ class NuntiusMessagesTable < ActionTable::ActionTable
14
14
  if message.nuntiable
15
15
  link_to "#{message.nuntiable_type} [#{message.nuntiable}]", begin
16
16
  url_for(message.nuntiable)
17
- rescue StandardError
18
- '#'
17
+ rescue
18
+ "#"
19
19
  end
20
20
  end
21
21
  end
@@ -3,13 +3,14 @@
3
3
  class NuntiusSubscribersTable < ActionTable::ActionTable
4
4
  model Nuntius::Subscriber
5
5
 
6
- column(:name, sortable: false) { |subscriber| subscriber.name }
6
+ column(:name, sortable: false)
7
7
  column(:email)
8
8
  column(:phonenumber)
9
+ column(:unsubscribed_at) { |subscriber| ln(subscriber.unsubscribed_at) }
9
10
 
10
11
  initial_order :name, :asc
11
12
 
12
- row_link { |subscriber| nuntius.edit_admin_list_subscriber_path(params[:list_id], subscriber) }
13
+ row_link { |subscriber| nuntius.edit_admin_list_subscriber_path(subscriber, list_id: subscriber.list) }
13
14
 
14
15
  private
15
16
 
@@ -7,14 +7,20 @@ class NuntiusTemplatesTable < ActionTable::ActionTable
7
7
  column(:enabled, as: :boolean)
8
8
  column(:klass)
9
9
  column(:event)
10
- column(:"# messages") { |template| link_to template.messages.count, nuntius.admin_messages_path(template_id: template.id) }
10
+ column(:messages, sort_field: "message_count") { |template| link_to template.messages.count, nuntius.admin_messages_path(template_id: template.id) }
11
11
 
12
12
  column(:metadata) { |template| Nuntius.config.metadata_humanize(template.metadata) }
13
- column(:created_at) { |flow| ln(flow.created_at) }
13
+ column(:created_at, html_value: proc { |flow| ln(flow.created_at) })
14
14
 
15
- column :actions, title: '', sortable: false do |template|
16
- content_tag(:span, class: 'btn-group btn-group-xs') do
17
- concat link_to(content_tag(:i, nil, class: 'fa fa-trash'), nuntius.admin_template_path(template), data: { turbo_confirm: 'Are you sure you want to delete the template?', turbo_method: :delete }, class: 'btn btn-xs btn-danger')
15
+ column(:traffic_light, sortable: false) do |template|
16
+ color = Nuntius.config.flow_color(template.id).light_color || "green"
17
+
18
+ "<span class='traffic-signal-#{color.downcase}'><i class='fa fa-circle fa-xl'></i></span>"
19
+ end
20
+
21
+ column :actions, title: "", sortable: false do |template|
22
+ content_tag(:span, class: "btn-group btn-group-xs") do
23
+ concat link_to(content_tag(:i, nil, class: "fa fa-trash"), nuntius.admin_template_path(template), data: {turbo_confirm: "Are you sure you want to delete the template?", turbo_method: :delete}, class: "btn btn-xs btn-danger")
18
24
  end
19
25
  end
20
26
 
@@ -26,5 +32,6 @@ class NuntiusTemplatesTable < ActionTable::ActionTable
26
32
 
27
33
  def scope
28
34
  @scope = Nuntius::Template.visible
35
+ @scope = Nuntius::Template.visible.select("nuntius_templates.*, (select count(id) from nuntius_messages where nuntius_messages.template_id = nuntius_templates.id) as message_count")
29
36
  end
30
37
  end
@@ -3,7 +3,7 @@
3
3
  module Nuntius
4
4
  class BaseTransport
5
5
  def kind
6
- self.class.name.demodulize.gsub(/Transport$/, '').underscore.to_sym
6
+ self.class.name.demodulize.gsub(/Transport$/, "").underscore.to_sym
7
7
  end
8
8
 
9
9
  def deliver(message)
@@ -18,7 +18,7 @@ module Nuntius
18
18
  message.to = tos.first
19
19
  messages << message
20
20
 
21
- tos[1..-1].each do |to|
21
+ tos[1..].each do |to|
22
22
  # FIXME: Sadly this also duplicates the attachments
23
23
  new_message = message.deep_dup
24
24
  new_message.to = to
@@ -5,7 +5,7 @@ module Nuntius
5
5
  # We split per email address, to allow easy resends
6
6
  def deliver(message)
7
7
  message.request_id = SecureRandom.uuid
8
- message.to.split(',').each do |to|
8
+ message.to.split(",").each do |to|
9
9
  new_message = message.dup
10
10
  new_message.to = to
11
11
  super(new_message)
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nuntius
4
+ class TeamsTransport < BaseTransport
5
+ end
6
+ end
@@ -1,7 +1,7 @@
1
1
  - if @campaign.draft?
2
2
  = sts.form_for [:admin, @campaign] do |f|
3
- = sts.card title: t('.campaign'), icon: 'fal fa-megaphone' do |card|
4
- - card.action
3
+ = sts.card :nuntius_admin_campaigns, icon: 'fal fa-megaphone' do |card|
4
+ - card.with_action
5
5
  = f.submit
6
6
 
7
7
  .grid.grid-cols-12.gap-4 data-controller="toggle"
@@ -31,19 +31,15 @@
31
31
  template data-toggle-target='toggleable' data-toggle-value='voice'
32
32
  .col-span-12
33
33
  = f.input :text, as: :editor, mode: 'text/plain'
34
-
35
-
36
34
  - else
37
- h2 = @campaign.name
38
- p We're sending this campaign, you can no longer make any changes. This is the audience we're sending it to:
39
-
40
- table.table
41
- thead
42
- tr
43
- th Status
44
- th To
45
- tbody
46
- - for message in @messages
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
47
38
  tr
48
- td = link_to message.status, admin_message_path(message)
49
- td = message.to
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
@@ -1,2 +1,2 @@
1
- = sts.card title: t('.campaigns'), icon: 'fad fa-megaphone', content_padding: false, menu: nuntius_campaigns_menu do |card|
2
- = sts.table :nuntius_campaigns
1
+ = sts.card :nuntius_admin_campaigns, icon: 'fad fa-megaphone', content_padding: false, menu: nuntius_campaigns_menu do |card|
2
+ = card.table :nuntius_campaigns, custom_views: true
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- json.selector 'ul.attachments'
4
- json.html render partial: 'nuntius/admin/layouts/attachments/attachments', layout: false, formats: [:html],
5
- locals: { attachments: @layout.attachments, upload_url: admin_layout_attachments_path(@layout) }
3
+ json.selector "ul.attachments"
4
+ json.html render partial: "nuntius/admin/layouts/attachments/attachments", layout: false, formats: [:html],
5
+ locals: {attachments: @layout.attachments, upload_url: admin_layout_attachments_path(@layout)}
@@ -1,24 +1,23 @@
1
1
  = sts.form_for([:admin, @layout]) do |f|
2
- = sts.card title: t('.layout'), icon: 'fal fa-table-layout' do |card|
3
- - card.action
2
+ = sts.card :nuntius_admin_layouts, icon: 'fal fa-table-layout' do |card|
3
+ - card.with_action
4
4
  = f.submit
5
5
 
6
- = sts.tabs do |tabs|
7
- - tabs.tab :edit
8
- .grid.grid-cols-12.gap-4
9
- .col-span-12
10
- = f.input :name
11
- .col-span-12
12
- = f.input :data, as: :editor, mode: 'text/html', height: '400px'
13
- - tabs.tab :metadata
14
- .grid.grid-cols-12.gap-4
15
- .col-span-12
16
- = f.input :metadata_yaml, as: :editor, mode: 'application/yaml', label: t('.metadata')
17
6
 
18
- - if @layout.persisted?
19
- - tabs.tab :media
20
- = render partial: 'nuntius/admin/layouts/attachments/index', locals: { attachments: @layout.attachments, upload_url: nuntius.admin_layout_attachments_path(@layout) }
7
+ - card.with_tab:edit, padding: true
8
+ .grid.grid-cols-12.gap-4
9
+ .col-span-12
10
+ = f.input :name
11
+ .col-span-12
12
+ = f.input :data, as: :editor, mode: 'text/html', height: '400px'
13
+ - card.with_tab:metadata, padding: true
14
+ .grid.grid-cols-12.gap-4
15
+ .col-span-12
16
+ = f.input :metadata_yaml, as: :editor, mode: 'application/yaml', label: t('.metadata')
21
17
 
22
- - if @layout.templates.size.positive?
23
- - tabs.tab :templates
24
- = sts.table :nuntius_templates, parameters: { layout_id: @layout.id }
18
+ - if @layout.persisted?
19
+ - card.with_tab:media, padding: true
20
+ = render partial: 'nuntius/admin/layouts/attachments/index', locals: { attachments: @layout.attachments, upload_url: nuntius.admin_layout_attachments_path(@layout) }
21
+
22
+ - if @layout.templates.size.positive?
23
+ = card.table :nuntius_templates, parameters: { layout_id: @layout.id }, custom_views: false, tab: :templates
@@ -1,2 +1,2 @@
1
- = sts.card title: t('.layouts'), icon: 'fad fa-table-layout', content_padding: false, menu: nuntius_layouts_menu do |card|
2
- = sts.table :nuntius_layouts
1
+ = sts.card :nuntius_admin_layouts, icon: 'fad fa-table-layout', content_padding: false, menu: nuntius_layouts_menu do |card|
2
+ = card.table :nuntius_layouts, custom_views: true
@@ -1,14 +1,24 @@
1
1
  = sts.form_for([:admin, @list]) do |f|
2
- = sts.card title: t('.list'), icon: 'fad fa-address-book', menu: nuntius_list_menu do |card|
3
- - card.action
2
+ = sts.card :nuntius_admin_lists, icon: 'fad fa-address-book', menu: nuntius_list_menu do |card|
3
+ - card.with_action
4
4
  = f.continue
5
- - card.action
5
+ - card.with_action
6
6
  = f.submit
7
7
 
8
- .grid.grid-cols-12.gap-4
9
- .col-span-12
10
- = f.input :name
8
+ - card.with_tab:edit, padding: true
9
+ .grid.grid-cols-12.gap-4
10
+ .col-span-6= f.input :name
11
+ .col-span-4= f.input :slug
12
+ .col-span-2= f.input :allow_unsubscribe, as: :switch
11
13
 
12
- br
13
- - if @list.subscribers.present?
14
- = sts.table :nuntius_subscribers, parameters: { list_id: @list.id }
14
+ .col-span-12.mt-4.mb-4
15
+ h4 = t('nuntius.admin.lists.edit.description')
16
+ p.mb-4 = t('nuntius.admin.lists.edit.description_hint')
17
+ = f.input :description, as: :hidden
18
+ trix-editor input="list_description" style="background-color: #fff; height: 400px; margin-bottom: 20px;"
19
+
20
+ .col-span-12
21
+ = f.input :metadata_yaml, as: :editor, mode: 'application/yaml'
22
+
23
+ - if @list.subscribers.present?
24
+ = card.table :nuntius_subscribers, parameters: { list_id: @list.id }, custom_views: false, tab: :nuntius_subscribers
@@ -1,2 +1,2 @@
1
- = sts.card title: t('.lists'), icon: 'fad fa-address-book', content_padding: false, menu: nuntius_lists_menu do |card|
2
- = sts.table :nuntius_lists
1
+ = sts.card :nuntius_admin_lists, icon: 'fad fa-address-book', content_padding: false, menu: nuntius_lists_menu do |card|
2
+ = card.table :nuntius_lists, custom_views: true
@@ -1,6 +1,6 @@
1
1
  = sts.form_for(@subscriber, url: @subscriber.new_record? ? admin_list_subscribers_path(@list) : admin_list_subscriber_path(@list, @subscriber), html: {multipart: true}) do |f|
2
- = sts.card title: t('.subscribers'), icon: 'fad fa-address-card' do |card|
3
- - card.action
2
+ = sts.card :nuntius_admin_lists_subscribers, title: t('.subscribers'), icon: 'fad fa-address-card' do |card|
3
+ - card.with_action
4
4
  = f.submit
5
5
 
6
6
  .grid.grid-cols-12.gap-4
@@ -1,8 +1,8 @@
1
1
  = sts.form_for([:admin, @locale]) do |f|
2
- = sts.card title: t('.locale'), icon: 'fal fa-language' do |card|
3
- - card.action
2
+ = sts.card :nuntius_admin_locales, icon: 'fal fa-language' do |card|
3
+ - card.with_action
4
4
  = f.continue
5
- - card.action
5
+ - card.with_action
6
6
  = f.submit
7
7
 
8
8
  .grid.grid-cols-12.gap-4
@@ -1,2 +1,2 @@
1
- = sts.card title: t('.locales'), icon: 'fad fa-language', content_padding: false, menu: nuntius_locales_menu do |card|
2
- = sts.table :nuntius_locales
1
+ = sts.card :nuntius_admin_locales, icon: 'fad fa-language', content_padding: false, menu: nuntius_locales_menu do |card|
2
+ = card.table :nuntius_locales, custom_views: true
@@ -1,2 +1,2 @@
1
- = sts.card title: t('.messages'), icon: 'fad fa-envelope', content_padding: false, menu: nuntius_messages_menu do |card|
2
- = sts.table :nuntius_messages, parameters: { template_id: params[:template_id] }
1
+ = sts.card :nuntius_admin_messages, icon: 'fad fa-envelope', content_padding: false do |card|
2
+ = card.table :nuntius_messages, custom_views: true
@@ -1,8 +1,8 @@
1
- = sts.card title: [t('.message'), @message.template&.description], icon: 'fad fa-envelope' do |card|
2
- - card.action
1
+ = sts.card :nuntius_admin_messages, title: [t('.message'), @message.template&.description], icon: 'fad fa-envelope' do |card|
2
+ - card.with_action
3
3
  = button_to(t('nuntius.context_menu.resend'), resend_admin_message_path(@message), class: 'button')
4
4
 
5
- - card.tab :preview, padding: true
5
+ - card.with_tab:preview, padding: true
6
6
 
7
7
  table.table
8
8
  thead
@@ -44,13 +44,13 @@
44
44
  - if @message.transport == 'mail' && @message.html.present?
45
45
  iframe.border.rounded-lg.border-gray-200 src=message_path(@message.id) style="width: 100%; height: 600px; border: 0px;"
46
46
 
47
- - card.tab :details, padding: true
47
+ - card.with_tab:details, padding: true
48
48
  = sts.info class: "grid grid-cols-1 gap-4 sm:grid-cols-3" do |info|
49
- = info.item :status, content: @message.status, class: "sm:col-span-1"
50
- = info.item :transport, content: @message.transport, class: "sm:col-span-1"
51
- = info.item :provider, content: @message.provider, class: "sm:col-span-1"
52
- = info.item :provider_id, content: @message.provider_id, class: "sm:col-span-1"
53
- = info.item :request_id, content: @message.request_id, class: "sm:col-span-1"
54
- = info.item :refreshes, content: @message.refreshes, class: "sm:col-span-1"
55
- = info.item :last_sent_at, content: ln(@message.last_sent_at), class: "sm:col-span-1", icon: 'fal fa-envelope'
56
- = info.item :created_at, content: ln(@message.created_at), class: "sm:col-span-1", icon: 'fal fa-calendar'
49
+ = info.with_item :status, content: @message.status, class: "sm:col-span-1"
50
+ = info.with_item :transport, content: @message.transport, class: "sm:col-span-1"
51
+ = info.with_item :provider, content: @message.provider, class: "sm:col-span-1"
52
+ = info.with_item :provider_id, content: @message.provider_id, class: "sm:col-span-1"
53
+ = info.with_item :request_id, content: @message.request_id, class: "sm:col-span-1"
54
+ = info.with_item :refreshes, content: @message.refreshes, class: "sm:col-span-1"
55
+ = info.with_item :last_sent_at, content: ln(@message.last_sent_at), class: "sm:col-span-1", icon: 'fal fa-envelope'
56
+ = info.with_item :created_at, content: ln(@message.created_at), class: "sm:col-span-1", icon: 'fal fa-calendar'
@@ -1,81 +1,79 @@
1
1
 
2
2
  - present(@template, TemplatePresenter) do |template|
3
3
  = sts.form_for([:admin, @template]) do |f|
4
- = sts.card title: t('.template'), icon: 'fal fa-file' do |card|
5
- - card.action
4
+ = sts.card :nuntius_admin_templates, icon: 'fal fa-file' do |card|
5
+ - card.with_action
6
6
  = f.continue
7
- - card.action
7
+ - card.with_action
8
8
  = f.submit
9
9
 
10
- = sts.tabs do |tabs|
11
- - tabs.tab :edit
12
- .grid.grid-cols-12.gap-4
13
- .col-span-1
14
- = f.input :enabled, as: :switch
15
- .col-span-11
16
- = f.input :description
17
-
18
- .grid.grid-cols-12.gap-4 data-controller='toggle'
10
+ - card.with_tab:edit, padding: true
11
+ .grid.grid-cols-12.gap-4
12
+ .col-span-1
13
+ = f.input :enabled, as: :switch
14
+ .col-span-11
15
+ = f.input :description
16
+
17
+ .grid.grid-cols-12.gap-4 data-controller='toggle'
18
+ .col-span-6
19
+ = f.input :klass, collection: Nuntius.config.nuntiable_class_names.sort, selected: @template.klass, input_html: { data: { 'toggle-target' => 'input' } }
20
+
21
+ .col-span-6 data-toggle-target="insertion"
22
+
23
+ template data-toggle-target='toggleable' data-toggle-not-value='Custom'
24
+ .col-span-6.deze data-controller='toggle' data-toggle-attr='data-timebased'
25
+ .grid.grid-cols-12.gap-4
26
+ .col-span-6
27
+ = f.input :event, collection: template.all_events, include_blank: false, chain_to: 'template[klass]', input_html: { data: { 'toggle-target' => 'input' } }, as: :dropdown
28
+ .col-span-6 data-toggle-target="insertion"
29
+ template data-toggle-target='toggleable' data-toggle-value='true'
30
+ = f.input :interval
31
+
32
+ template data-toggle-target='toggleable' data-toggle-value='Custom'
19
33
  .col-span-6
20
- = f.input :klass, collection: Nuntius.config.nuntiable_class_names.sort, selected: @template.klass, input_html: { data: { 'toggle-target' => 'input' } }
34
+ = f.input :event, input_html: { placeholder: 'scope#event' }
21
35
 
22
- .col-span-6 data-toggle-target="insertion"
36
+ .grid.grid-cols-12.gap-4 data-controller='toggle'
23
37
 
24
- template data-toggle-target='toggleable' data-toggle-not-value='Custom'
25
- .col-span-6.deze data-controller='toggle' data-toggle-attr='data-timebased'
26
- .grid.grid-cols-12.gap-4
27
- .col-span-6
28
- = f.input :event, collection: template.all_events, include_blank: false, chain_to: 'template[klass]', input_html: { data: { 'toggle-target' => 'input' } }, as: :dropdown
29
- .col-span-6 data-toggle-target="insertion"
30
- template data-toggle-target='toggleable' data-toggle-value='true'
31
- = f.input :interval
38
+ .col-span-12
39
+ = f.input :transport, collection: Nuntius.config.transports, include_blank: false, input_html: { "data-toggle-target" => 'input' }
32
40
 
33
- template data-toggle-target='toggleable' data-toggle-value='Custom'
34
- .col-span-6
35
- = f.input :event, input_html: { placeholder: 'scope#event' }
41
+ .col-span-6
42
+ = f.input :from
43
+ .col-span-6
44
+ = f.input :to
36
45
 
37
- .grid.grid-cols-12.gap-4 data-controller='toggle'
46
+ .col-span-12
47
+ .grid.grid-cols-12.gap-4 data-toggle-target="insertion"
38
48
 
39
- .col-span-12
40
- = f.input :transport, collection: Nuntius.config.transports, include_blank: false, input_html: { "data-toggle-target" => 'input' }
49
+ .col-span-12
50
+ = f.input :metadata_yaml, as: :editor, mode: 'application/yaml', label: t('.metadata')
41
51
 
42
- .col-span-6
43
- = f.input :from
44
- .col-span-6
45
- = f.input :to
52
+ template data-toggle-target='toggleable' data-toggle-value='mail'
53
+ .col-span-12
54
+ = f.input :subject, as: :editor, mode: 'text/plain'
55
+ .col-span-12
56
+ = f.association :layout, collection: @layouts, include_blank: true
57
+ .col-span-12
58
+ = f.input :html, as: :editor, mode: 'text/markdown'
46
59
 
60
+ template data-toggle-target='toggleable' data-toggle-value='voice'
61
+ .col-span-12
62
+ = f.input :text, as: :editor, mode: 'text/plain'
63
+ template data-toggle-target='toggleable' data-toggle-value='slack'
64
+ .col-span-12
65
+ = f.input :text, as: :editor, mode: 'text/plain'
47
66
  .col-span-12
48
- .grid.grid-cols-12.gap-4 data-toggle-target="insertion"
67
+ = f.input :payload, as: :editor, mode: 'application/yaml', hint: 'See here for more information: https://app.slack.com/block-kit-builder/'
49
68
 
69
+ template data-toggle-target='toggleable' data-toggle-value='sms'
50
70
  .col-span-12
51
- = f.input :metadata_yaml, as: :editor, mode: 'application/yaml', label: t('.metadata')
52
-
53
- template data-toggle-target='toggleable' data-toggle-value='mail'
54
- .col-span-12
55
- = f.input :subject, as: :editor, mode: 'text/plain'
56
- .col-span-12
57
- = f.association :layout, collection: @layouts, include_blank: true
58
- .col-span-12
59
- = f.input :html, as: :editor, mode: 'text/markdown'
60
-
61
- template data-toggle-target='toggleable' data-toggle-value='voice'
62
- .col-span-12
63
- = f.input :text, as: :editor, mode: 'text/plain'
64
- template data-toggle-target='toggleable' data-toggle-value='slack'
65
- .col-span-12
66
- = f.input :text, as: :editor, mode: 'text/plain'
67
- .col-span-12
68
- = f.input :payload, as: :editor, mode: 'application/yaml'
69
-
70
- template data-toggle-target='toggleable' data-toggle-value='sms'
71
- .col-span-12
72
- = f.input :text, as: :editor, mode: 'text/plain'
73
- template data-toggle-target='toggleable' data-toggle-value='push'
74
- .col-span-12
75
- = f.input :text, as: :editor, mode: 'text/plain'
76
- template data-toggle-target='toggleable' data-toggle-value='slack'
77
-
78
-
79
- - if @template.messages.size.positive?
80
- - tabs.tab :nuntius_messages, badge: @template.messages.size, padding: false
81
- = sts.table :nuntius_messages, parameters: { template_id: @template.id }
71
+ = f.input :text, as: :editor, mode: 'text/plain'
72
+ template data-toggle-target='toggleable' data-toggle-value='push'
73
+ .col-span-12
74
+ = f.input :text, as: :editor, mode: 'text/plain'
75
+ template data-toggle-target='toggleable' data-toggle-value='slack'
76
+
77
+
78
+ - if @template.messages.size.positive?
79
+ = card.table :nuntius_messages, parameters: { template_id: @template.id }, custom_views: false, tab: :nuntius_messages
@@ -1,2 +1,2 @@
1
- = sts.card title: t('.templates'), icon: 'fad fa-language', content_padding: false, menu: nuntius_templates_menu do |card|
2
- = sts.table :nuntius_templates
1
+ = sts.card :nuntius_admin_templates, icon: 'fad fa-language', content_padding: false, menu: nuntius_templates_menu do |card|
2
+ = card.table :nuntius_templates, custom_views: true
@@ -1,7 +1,3 @@
1
- .grid.grid-cols-1.gap-4.sm:grid-cols-3
1
+ /.grid.grid-cols-1.gap-4.sm:grid-cols-3
2
2
  .col-span-3.sm:col-span-3
3
- = reportlet(:'nuntius/daily_messages_per_template', parameters: { menu: :nuntius_dashboard_menu, template_ids: @templates.map(&:id)})
4
-
5
- .col-span-3.sm:col-span-3
6
- = sts.card title: t('.messages'), icon: 'fad fa-envelope', content_padding: false, menu: nuntius_dashboard_menu do |card|
7
- = sts.table :nuntius_messages, parameters: {template_id: params[:template_id]}
3
+ = reportlet(:'nuntius/daily_messages_per_template', parameters: { template_ids: @templates.map(&:id) })
@@ -0,0 +1,9 @@
1
+
2
+ = sts.card :subscriber, title: @list.name do |card|
3
+ - card.with_action
4
+ - if @subscriber.unsubscribed_at.present?
5
+ = link_to 'Resubscribe', subscribe_subscriber_path(@subscriber), data: { turbo_method: :post }, class: 'button'
6
+ - else
7
+ = link_to 'Unsubscribe', unsubscribe_subscriber_path(@subscriber), data: { turbo_method: :post }, class: 'button primary'
8
+
9
+ p== sanitize @list.description