From f3440389bedf194f31db912e07726d738adc861c Mon Sep 17 00:00:00 2001 From: Joseph Cohen Date: Sat, 28 May 2016 12:25:36 -0500 Subject: [PATCH] Improve email content and subject, fix component notification presenter --- ...omponentUpdateEmailNotificationHandler.php | 4 +++- .../SendIncidentEmailNotificationHandler.php | 7 +++++- ...endMaintenanceEmailNotificationHandler.php | 6 ++++- resources/lang/en/cachet.php | 6 ++--- .../incidents/maintenance-html.blade.php | 22 ++++++++++++------- .../incidents/maintenance-text.blade.php | 9 ++++---- .../views/emails/incidents/new-html.blade.php | 20 ++++++++++++----- .../views/emails/incidents/new-text.blade.php | 7 +++--- resources/views/layout/emails.blade.php | 18 +++++++++++++-- 9 files changed, 69 insertions(+), 30 deletions(-) diff --git a/app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php b/app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php index 264d2bf5..38dd9689 100644 --- a/app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php +++ b/app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php @@ -57,7 +57,7 @@ class SendComponentUpdateEmailNotificationHandler */ public function handle(ComponentWasUpdatedEvent $event) { - $component = AutoPresenter::decorate($event->component); + $component = $event->component; // First notify all global subscribers. $globalSubscribers = $this->subscriber->isVerified()->isGlobal()->get(); @@ -92,6 +92,8 @@ class SendComponentUpdateEmailNotificationHandler */ public function notify(Component $component, Subscriber $subscriber) { + $component = AutoPresenter::decorate($component); + $mail = [ 'subject' => trans('cachet.subscriber.email.component.subject'), 'component_name' => $component->name, diff --git a/app/Bus/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php b/app/Bus/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php index f55c263d..f92e49c0 100644 --- a/app/Bus/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php +++ b/app/Bus/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php @@ -107,9 +107,14 @@ class SendIncidentEmailNotificationHandler $mail = [ 'email' => $subscriber->email, - 'subject' => 'New incident reported.', + 'subject' => trans('cachet.subscriber.email.incident.subject', [ + 'status' => $incident->human_status, + 'name' => $incident->name, + ]), 'has_component' => ($event->incident->component) ? true : false, 'component_name' => $component ? $component->name : null, + 'name' => $incident->name, + 'timestamp' => $incident->created_at_formatted, 'status' => $incident->human_status, 'html_content' => $incident->formattedMessage, 'text_content' => $incident->message, diff --git a/app/Bus/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php b/app/Bus/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php index 7d9d9708..faa4fd38 100644 --- a/app/Bus/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php +++ b/app/Bus/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php @@ -107,9 +107,13 @@ class SendMaintenanceEmailNotificationHandler $mail = [ 'email' => $subscriber->email, - 'subject' => 'Scheduled maintenance.', + 'subject' => trans('cachet.subscriber.email.maintenance.subject', [ + 'name' => $incident->name, + ]), 'has_component' => ($event->incident->component) ? true : false, 'component_name' => $component ? $component->name : null, + 'name' => $incident->name, + 'timestamp' => $incident->scheduled_at_formatted, 'status' => $incident->human_status, 'html_content' => $incident->formattedMessage, 'text_content' => $incident->message, diff --git a/resources/lang/en/cachet.php b/resources/lang/en/cachet.php index 57013e1e..46b71e90 100755 --- a/resources/lang/en/cachet.php +++ b/resources/lang/en/cachet.php @@ -86,12 +86,10 @@ return [ 'button' => 'Confirm Subscription', ], 'maintenance' => [ - 'text' => "New maintenance has been scheduled on :app_name.\nThank you, :app_name", - 'html' => '

New maintenance has been scheduled on :app_name.

', + 'subject' => "[Maintenance Scheduled] :name", ], 'incident' => [ - 'text' => "New incident has been reported on :app_name.\nThank you, :app_name", - 'html' => '

New incident has been reported on :app_name.

Thank you, :app_name

', + 'subject' => "[New Incident] :status: :name", ], 'component' => [ 'subject' => 'Component Status Update', diff --git a/resources/views/emails/incidents/maintenance-html.blade.php b/resources/views/emails/incidents/maintenance-html.blade.php index 532b7fbd..c30598c0 100644 --- a/resources/views/emails/incidents/maintenance-html.blade.php +++ b/resources/views/emails/incidents/maintenance-html.blade.php @@ -1,13 +1,19 @@ @extends('layout.emails') @section('content') -{!! trans('cachet.subscriber.email.maintenance.html', ['app_name' => $app_name]) !!} +

{!! $name !!}

-

{{ $scheduled_at }}

- -

{!! $status !!}

- -

{!! $html_content !!}

+ + + + +
+

+ {!! $status !!} @if($has_component) ({{ $component_name }}) @endif + {!! $html_content !!} + {!! $timestamp !!} +

+
@@ -24,9 +30,9 @@
- +
- diff --git a/resources/views/emails/incidents/maintenance-text.blade.php b/resources/views/emails/incidents/maintenance-text.blade.php index 513dca8a..07024911 100644 --- a/resources/views/emails/incidents/maintenance-text.blade.php +++ b/resources/views/emails/incidents/maintenance-text.blade.php @@ -1,11 +1,12 @@ -{!! trans('cachet.subscriber.email.maintenance.text', ['app_name' => $app_name]) !!} - -{{ $scheduled_at }} +{!! $name !!} {!! $status !!} - {!! $text_content !!} +{!! $timestamp !!} +@if($has_component) +({{ $component_name }}) +@endif {!! trans('cachet.subscriber.email.manage') !!} {{ $manage_link }} {!! trans('cachet.subscriber.email.unsubscribe') !!} {{ $unsubscribe_link }} diff --git a/resources/views/emails/incidents/new-html.blade.php b/resources/views/emails/incidents/new-html.blade.php index 5d0ea79b..c30598c0 100644 --- a/resources/views/emails/incidents/new-html.blade.php +++ b/resources/views/emails/incidents/new-html.blade.php @@ -1,11 +1,19 @@ @extends('layout.emails') @section('content') -{!! trans('cachet.subscriber.email.incident.html-preheader', ['app_name' => $app_name]) !!} +

{!! $name !!}

-

{!! $status !!} @if($has_component) ({{ $component_name }})@endif

- -

{!! $html_content !!}

+
+

{!! trans('cachet.subscriber.email.unsubscribe') !!}

+ + + +
+

+ {!! $status !!} @if($has_component) ({{ $component_name }}) @endif + {!! $html_content !!} + {!! $timestamp !!} +

+
@@ -22,9 +30,9 @@
- +
- diff --git a/resources/views/emails/incidents/new-text.blade.php b/resources/views/emails/incidents/new-text.blade.php index 9ec07cf8..80616d1e 100644 --- a/resources/views/emails/incidents/new-text.blade.php +++ b/resources/views/emails/incidents/new-text.blade.php @@ -1,12 +1,13 @@ -{!! trans('cachet.subscriber.email.incident.text', ['app_name' => $app_name]) !!} +{!! $name !!} {!! $status !!} +{!! $text_content !!} +{!! $timestamp !!} + @if($has_component) ({{ $component_name }}) @endif -{!! $text_content !!} - {!! trans('cachet.subscriber.email.manage') !!} {{ $manage_link }} {!! trans('cachet.subscriber.email.unsuscribe') !!} {{ $unsubscribe_link }} diff --git a/resources/views/layout/emails.blade.php b/resources/views/layout/emails.blade.php index fe6007c2..bc136388 100644 --- a/resources/views/layout/emails.blade.php +++ b/resources/views/layout/emails.blade.php @@ -53,7 +53,7 @@ border: 0; } .email-masthead_name { - font-size: 16px; + font-size: 40px; font-weight: bold; color: #bbbfc3; text-decoration: none; @@ -83,6 +83,9 @@ .email-footer p { color: #AEAEAE; } + .email-footer img { + width: 30px; + } .body-action { width: 100%; margin: 30px auto; @@ -97,15 +100,23 @@ .content-cell { padding: 35px; } + .align-center { + text-align: center; + } .align-right { text-align: right; } + .border-rounded { + border: 1px solid #EDEFF2; + border-radius: 3px; + padding: 12px; + } /* Type ------------------------------ */ h1 { margin-top: 0; color: #2F3133; - font-size: 19px; + font-size: 36px; font-weight: bold; text-align: left; } @@ -130,6 +141,9 @@ line-height: 1.5em; text-align: left; } + p.compressed { + margin: 0; + } p.sub { font-size: 12px; }
+

{!! trans('cachet.subscriber.email.unsubscribe') !!}