Handle subscribers

This commit is contained in:
Joseph Cohen 2015-05-24 16:33:03 -05:00
parent 254c578ca2
commit 55dcf3a277
48 changed files with 1214 additions and 35 deletions

View File

@ -11,7 +11,7 @@ DB_PASSWORD=secret
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
QUEUE_DRIVER=database
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io

View File

@ -32,6 +32,6 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
//
$schedule->command('queue:work --sleep=3 --tries=3')->everyMinute();
}
}

View File

@ -0,0 +1,34 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Cachet HQ <support@cachethq.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Events;
use CachetHQ\Cachet\Models\Subscriber;
class CustomerHasSubscribedEvent
{
/**
* The customer who has subscribed.
*
* @var \CachetHQ\Cachet\Models\Subscriber
*/
public $subscriber;
/**
* Create a new customer has subscribed event instance.
*
* @return void
*/
public function __construct(Subscriber $subscriber)
{
$this->subscriber = $subscriber;
}
}

View File

@ -0,0 +1,34 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Cachet HQ <support@cachethq.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Events;
use CachetHQ\Cachet\Models\Incident;
class IncidentHasReportedEvent
{
/**
* The incident that has been reported.
*
* @var \CachetHQ\Cachet\Models\Incident
*/
public $incident;
/**
* Create a new incident has reported event instance.
*
* @return void
*/
public function __construct(Incident $incident)
{
$this->incident = $incident;
}
}

View File

@ -0,0 +1,34 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Cachet HQ <support@cachethq.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Events;
use CachetHQ\Cachet\Models\Incident;
class MaintenanceHasScheduledEvent
{
/**
* The incident that has been reported.
*
* @var \CachetHQ\Cachet\Models\Incident
*/
public $incident;
/**
* Create a new maintenance has scheduled event instance.
*
* @return void
*/
public function __construct(Incident $incident)
{
$this->incident = $incident;
}
}

View File

@ -0,0 +1,88 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Cachet HQ <support@cachethq.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Handlers\Events;
use CachetHQ\Cachet\Events\IncidentHasReportedEvent;
use CachetHQ\Cachet\Models\Subscriber;
use Illuminate\Contracts\Mail\MailQueue;
use Illuminate\Mail\Message;
use McCool\LaravelAutoPresenter\PresenterDecorator;
class SendIncidentEmailNotificationHandler
{
/**
* The mailer instance.
*
* @var \Illuminate\Contracts\Mail\Mailer
*/
protected $mailer;
/**
* The subscriber instance.
*
* @var \CachetHQ\Cachet\Models\Subscriber
*/
protected $subscriber;
/**
* The presenter instance.
*
* @var \McCool\LaravelAutoPresenter\PresenterDecorator
*/
protected $presenter;
/**
* Create a new send incident email notification handler.
*
* @param \Illuminate\Contracts\Mail\Mailer $mailer
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
* @param \McCool\LaravelAutoPresenter\PresenterDecorator $presenter
*
* @return void
*/
public function __construct(MailQueue $mailer, Subscriber $subscriber, PresenterDecorator $presenter)
{
$this->mailer = $mailer;
$this->subscriber = $subscriber;
$this->presenter = $presenter;
}
/**
* Handle the event.
*
* @param \CachetHQ\Cachet\Events\IncidentHasReportedEvent $event
*
* @return void
*/
public function handle(IncidentHasReportedEvent $event)
{
$data = $this->presenter->decorate($event->incident);
foreach ($this->subscriber->all() as $subscriber) {
$mail = [
'email' => $subscriber->email,
'subject' => 'New incident reported.',
'status' => $data->humanStatus,
'htmlContent' => $data->formattedMessage,
'textContent' => $data->message,
'token' => $subscriber->token,
];
$this->mailer->queue([
'html' => 'emails.incidents.new-html',
'text' => 'emails.incidents.new-text',
], $mail, function (Message $message) use ($mail) {
$message->to($mail['email'])->subject($mail['subject']);
});
}
}
}

View File

@ -0,0 +1,88 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Cachet HQ <support@cachethq.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Handlers\Events;
use CachetHQ\Cachet\Events\MaintenanceHasScheduledEvent;
use CachetHQ\Cachet\Models\Subscriber;
use Illuminate\Contracts\Mail\MailQueue;
use Illuminate\Mail\Message;
use McCool\LaravelAutoPresenter\PresenterDecorator;
class SendMaintenanceEmailNotificationHandler
{
/**
* The mailer instance.
*
* @var \Illuminate\Contracts\Mail\MailQueue
*/
protected $mailer;
/**
* The subscriber instance.
*
* @var \CachetHQ\Cachet\Models\Subscriber
*/
protected $subscriber;
/**
* The presenter instance.
*
* @var \McCool\LaravelAutoPresenter\PresenterDecorator
*/
protected $presenter;
/**
* Create a new send maintenance email notification handler.
*
* @param \Illuminate\Contracts\Mail\Mailer $mailer
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
* @param \McCool\LaravelAutoPresenter\PresenterDecorator $presenter
*
* @return void
*/
public function __construct(MailQueue $mailer, Subscriber $subscriber, PresenterDecorator $presenter)
{
$this->mailer = $mailer;
$this->subscriber = $subscriber;
$this->presenter = $presenter;
}
/**
* Handle the event.
*
* @param \CachetHQ\Cachet\Events\MaintenanceHasScheduledEvent $event
*
* @return void
*/
public function handle(MaintenanceHasScheduledEvent $event)
{
$data = $this->presenter->decorate($event->incident);
foreach ($this->subscriber->all() as $subscriber) {
$mail = [
'email' => $subscriber->email,
'subject' => 'Scheduled maintenance.',
'status' => $data->humanStatus,
'htmlContent' => $data->formattedMessage,
'textContent' => $data->message,
'token' => $subscriber->token,
];
$this->mailer->queue([
'html' => 'emails.incidents.maintenance-html',
'text' => 'emails.incidents.maintenance-text',
], $mail, function (Message $message) use ($mail) {
$message->to($mail['email'])->subject($mail['subject']);
});
}
}
}

View File

@ -0,0 +1,61 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Cachet HQ <support@cachethq.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Handlers\Events;
use CachetHQ\Cachet\Events\CustomerHasSubscribedEvent;
use Illuminate\Contracts\Mail\MailQueue;
use Illuminate\Mail\Message;
class SendSubscriberVerificationEmailHandler
{
/**
* The mailer instance.
*
* @var \Illuminate\Contracts\Mail\MailQueue
*/
protected $mailer;
/**
* Create a new send subscriber verification email handler.
*
* @param \Illuminate\Contracts\Mail\Mailer $mailer
*
* @return void
*/
public function __construct(MailQueue $mailer)
{
$this->mailer = $mailer;
}
/**
* Handle the event.
*
* @param \CachetHQ\Cachet\Events\CustomerHasSubscribedEvent $event
*
* @return void
*/
public function handle(CustomerHasSubscribedEvent $event)
{
$mail = [
'email' => $event->subscriber->email,
'subject' => 'Confirm your subscription.',
'link' => route('subscribe-verify', ['code' => $event->subscriber->verify_code]),
];
$this->mailer->queue([
'html' => 'emails.subscribers.verify-html',
'text' => 'emails.subscribers.verify-text',
], $mail, function (Message $message) use ($mail) {
$message->to($mail['email'])->subject($mail['subject']);
});
}
}

View File

@ -11,6 +11,7 @@
namespace CachetHQ\Cachet\Http\Controllers\Admin;
use CachetHQ\Cachet\Events\IncidentHasReportedEvent;
use CachetHQ\Cachet\Facades\Setting;
use CachetHQ\Cachet\Http\Controllers\AbstractController;
use CachetHQ\Cachet\Models\Component;
@ -159,6 +160,10 @@ class IncidentController extends AbstractController
trans('dashboard.incidents.add.success')
);
if (array_get($incidentData, 'notify')) {
event(new IncidentHasReportedEvent($incident));
}
return Redirect::back()->with('success', $successMsg);
}

View File

@ -11,6 +11,7 @@
namespace CachetHQ\Cachet\Http\Controllers\Admin;
use CachetHQ\Cachet\Events\MaintenanceHasScheduledEvent;
use CachetHQ\Cachet\Facades\Setting;
use CachetHQ\Cachet\Http\Controllers\AbstractController;
use CachetHQ\Cachet\Models\Incident;
@ -139,6 +140,10 @@ class ScheduleController extends AbstractController
trans('dashboard.schedule.add.success')
);
if (array_get($scheduleData, 'notify')) {
event(new MaintenanceHasScheduledEvent($incident));
}
return Redirect::back()->with('success', $successMsg);
}

View File

@ -0,0 +1,149 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Cachet HQ <support@cachethq.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Http\Controllers;
use CachetHQ\Cachet\Events\CustomerHasSubscribedEvent;
use CachetHQ\Cachet\Facades\Setting;
use CachetHQ\Cachet\Models\Subscriber;
use Carbon\Carbon;
use GrahamCampbell\Binput\Facades\Binput;
use GrahamCampbell\Markdown\Facades\Markdown;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class SubscribeController extends AbstractController
{
/**
* Show the subscribe by email page.
*
* @return \Illuminate\View\View
*/
public function showSubscribe()
{
return View::make('subscribe', [
'pageTitle' => Setting::get('app_name'),
'aboutApp' => Markdown::convertToHtml(Setting::get('app_about')),
]);
}
/**
* Handle the subscribe user.
*
* @return \Illuminate\View\View
*/
public function postSubscribe()
{
$subscriber = Subscriber::create(['email' => Binput::get('email')]);
if (!$subscriber->isValid()) {
segment_track('Subscribers', [
'event' => 'Customer Subscribed',
'success' => false,
]);
return Redirect::back()->withInput(Binput::all())
->with('title', sprintf(
'<strong>%s</strong> %s',
trans('dashboard.notifications.whoops'),
trans('cachet.subscriber.email.failure')
))
->with('errors', $subscriber->getErrors());
}
segment_track('Subscribers', [
'event' => 'Customer Subscribed',
'success' => true,
]);
$successMsg = sprintf(
'<strong>%s</strong> %s',
trans('dashboard.notifications.awesome'),
trans('cachet.subscriber.email.subscribed')
);
event(new CustomerHasSubscribedEvent($subscriber));
return Redirect::route('status-page')->with('success', $successMsg);
}
/**
* Handle the verify subscriber email.
*
* @param string $code
*
* @return \Illuminate\View\View
*/
public function getVerify($code = null)
{
if (is_null($code)) {
throw new NotFoundHttpException();
}
$subscriber = Subscriber::where('verify_code', '=', $code)->first();
if (!$subscriber || $subscriber->verified()) {
return Redirect::route('status-page');
}
$subscriber->verified_at = Carbon::now();
$subscriber->save();
segment_track('Subscribers', [
'event' => 'Customer Email Verified',
'success' => true,
]);
$successMsg = sprintf(
'<strong>%s</strong> %s',
trans('dashboard.notifications.awesome'),
trans('cachet.subscriber.email.verified')
);
return Redirect::route('status-page')->with('success', $successMsg);
}
/**
* Handle the unsubscribe.
*
* @param string $code
*
* @return \Illuminate\View\View
*/
public function getUnsubscribe($code = null)
{
if (is_null($code)) {
throw new NotFoundHttpException();
}
$subscriber = Subscriber::where('verify_code', '=', $code)->first();
if (!$subscriber || !$subscriber->verified()) {
return Redirect::route('status-page');
}
$subscriber->delete();
segment_track('Subscribers', [
'event' => 'Customer Unsubscribed',
'success' => true,
]);
$successMsg = sprintf(
'<strong>%s</strong> %s',
trans('dashboard.notifications.awesome'),
trans('cachet.subscriber.email.unsuscribed')
);
return Redirect::route('status-page')->with('success', $successMsg);
}
}

View File

@ -28,6 +28,22 @@ class StatusPageRoutes
'as' => 'status-page',
'uses' => 'HomeController@showIndex',
]);
$router->get('subscribe', [
'as' => 'subscribe-page',
'uses' => 'SubscribeController@showSubscribe',
]);
$router->post('subscribe', [
'as' => 'subscribe',
'uses' => 'SubscribeController@postSubscribe',
]);
$router->get('subscribe/verify/{code}', [
'as' => 'subscribe-verify',
'uses' => 'SubscribeController@getVerify',
]);
$router->get('unsubscribe/{code}', [
'as' => 'unsubscribe',
'uses' => 'SubscribeController@getUnsubscribe',
]);
$router->get('/atom/{component_group?}', 'AtomController@feedAction');
$router->get('/rss/{component_group?}', 'RssController@feedAction');
});

View File

@ -18,6 +18,8 @@ use Watson\Validating\ValidatingTrait;
/**
* @property int $id
* @property string $email
* @property string $verify_code
* @property \Carbon\Carbon $verified_at
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at
@ -32,7 +34,7 @@ class Subscriber extends Model
* @var string[]
*/
protected $rules = [
'email' => 'required|email',
'email' => 'required|email|unique:subscribers',
];
/**
@ -41,4 +43,47 @@ class Subscriber extends Model
* @var string[]
*/
protected $fillable = ['email'];
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = ['deleted_at', 'verified_at'];
/**
* Overrides the models boot method.
*
* @return void
*/
public static function boot()
{
parent::boot();
self::creating(function ($user) {
if (!$user->verify_code) {
$user->verify_code = self::generateVerifyCode();
}
});
}
/**
* Determines if the subscriber is verified.
*
* @return bool
*/
public function verified()
{
return !is_null($this->verified_at);
}
/**
* Returns an new verify code.
*
* @return string
*/
public static function generateVerifyCode()
{
return str_random(42);
}
}

View File

@ -28,8 +28,8 @@ class ComposerServiceProvider extends ServiceProvider
public function register()
{
$this->app->view->composer('*', LoggedUserComposer::class);
$this->app->view->composer('index', IndexComposer::class);
$this->app->view->composer('index', ThemeComposer::class);
$this->app->view->composer(['index', 'subscribe'], IndexComposer::class);
$this->app->view->composer(['index', 'subscribe'], ThemeComposer::class);
$this->app->view->composer('dashboard.*', DashboardComposer::class);
$this->app->view->composer(['setup', 'dashboard.settings.app-setup'], TimezoneLocaleComposer::class);
}

View File

@ -21,8 +21,14 @@ class EventServiceProvider extends ServiceProvider
* @var array
*/
protected $listen = [
'event.name' => [
'EventListener',
'CachetHQ\Cachet\Events\CustomerHasSubscribedEvent' => [
'CachetHQ\Cachet\Handlers\Events\SendSubscriberVerificationEmailHandler',
],
'CachetHQ\Cachet\Events\IncidentHasReportedEvent' => [
'CachetHQ\Cachet\Handlers\Events\SendIncidentEmailNotificationHandler',
],
'CachetHQ\Cachet\Events\MaintenanceHasScheduledEvent' => [
'CachetHQ\Cachet\Handlers\Events\SendMaintenanceEmailNotificationHandler',
],
];
}

View File

@ -0,0 +1,41 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Cachet HQ <support@cachethq.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Providers;
use Illuminate\Support\ServiceProvider;
class ViewComposerServiceProvider extends ServiceProvider
{
/**
* Boot the service provider.
*/
public function boot()
{
//
}
/**
* Register the service provider.
*/
public function register()
{
$this->app->view->composer('*', 'CachetHQ\Cachet\Composers\LoggedUserComposer');
$this->app->view->composer('index', 'CachetHQ\Cachet\Composers\IndexComposer');
$this->app->view->composer('index', 'CachetHQ\Cachet\Composers\ThemeComposer');
$this->app->view->composer('subscribe', 'CachetHQ\Cachet\Composers\ThemeComposer');
$this->app->view->composer('dashboard.*', 'CachetHQ\Cachet\Composers\DashboardComposer');
$this->app->view->composer([
'setup',
'dashboard.settings.app-setup',
], 'CachetHQ\Cachet\Composers\TimezoneLocaleComposer');
}
}

View File

@ -25,7 +25,7 @@ return [
|
*/
'default' => env('QUEUE_DRIVER', 'sync'),
'default' => env('QUEUE_DRIVER', 'database'),
/*
|--------------------------------------------------------------------------

View File

@ -13,18 +13,22 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSubscriptionsTable extends Migration
class CreateSubscribersTable extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::create('subscriptions', function (Blueprint $table) {
Schema::create('subscribers', function (Blueprint $table) {
$table->increments('id');
$table->string('email');
$table->string('verify_code');
$table->timestamp('verified_at')->nullable();
$table->timestamps();
$table->softDeletes();
$table->unique(['email']);
});
}
@ -33,6 +37,6 @@ class CreateSubscriptionsTable extends Migration
*/
public function down()
{
Schema::drop('subscriptions');
Schema::drop('subscribers');
}
}

View File

@ -0,0 +1,45 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Cachet HQ <support@cachethq.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue');
$table->text('payload');
$table->tinyInteger('attempts')->unsigned();
$table->tinyInteger('reserved')->unsigned();
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('jobs');
}
}

View File

@ -0,0 +1,42 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Cachet HQ <support@cachethq.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->increments('id');
$table->text('connection');
$table->text('queue');
$table->text('payload');
$table->timestamp('failed_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('failed_jobs');
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"dist/css/all.css": "dist/css/all-100868c6.css",
"dist/css/all.css": "dist/css/all-73d97429.css",
"dist/js/all.js": "dist/js/all-c132bc1e.js"
}

View File

@ -17,6 +17,7 @@ html, body {
@import "modules/well";
@import "modules/alerts";
@import "modules/panels";
@import "modules/btns";
// Styles for partials
@import "partials/base";

View File

@ -0,0 +1,37 @@
.btn-outline {
background-color: transparent;
color: inherit;
transition: all .5s;
}
.btn-default.btn-outline {
color: #999;
}
.btn-primary.btn-outline {
color: #428bca;
}
.btn-success.btn-outline {
color: #5cb85c;
}
.btn-info.btn-outline {
color: #5bc0de;
}
.btn-warning.btn-outline {
color: #f0ad4e;
}
.btn-danger.btn-outline {
color: #d9534f;
}
.btn-primary.btn-outline:hover,
.btn-success.btn-outline:hover,
.btn-info.btn-outline:hover,
.btn-warning.btn-outline:hover,
.btn-danger.btn-outline:hover {
color: #fff;
}

View File

@ -47,6 +47,44 @@ return [
'revoke' => 'API-Schlüssel löschen',
],
// Metrics
'metrics' => [
'filter' => [
'hourly' => 'Hourly',
'daily' => 'Daily',
'monthly' => 'Monthly',
],
],
// Subscriber
'subscriber' => [
'subscribe' => 'Subscribe to get the most recent updates.',
'button' => 'Subscribe',
'email' => [
'subscribe' => 'Subscribe to email updates.',
'subscribed' => 'You\'ve been subscribed to email notifications, please check your email to confirm your subscription.',
'verified' => 'Your email subscription has been confirmed. Thank you!',
'unsubscribe' => 'Unsuscribe from email updates.',
'unsubscribed' => 'Your email subscription has been cancelled.',
'failure' => 'Something went wrong with the subscription.',
'verify' => [
'text' => "Please confirm your email subscription to :app_name status updates.\n:link\nThank you, :app_name",
'html-preheader' => 'Please confirm your email subscription to :app_name status updates.',
'html' => '<p>Please confirm your email subscription to :app_name status updates.</p><p>:link</p><p>Thank you, :app_name</p>',
],
'maintenance' => [
'text' => "New maintenance has been scheduled on :app_name.\nThank you, :app_name",
'html-preheader' => 'New maintenance has been scheduled on :app_name.',
'html' => '<p>New maintenance has been scheduled on :app_name.</p><p>Thank you, :app_name</p>',
],
'incident' => [
'text' => "New incident has been reported on :app_name.\nThank you, :app_name",
'html-preheader' => 'New incident has been reported on :app_name.',
'html' => '<p>New incident has been reported on :app_name.</p><p>Thank you, :app_name</p>',
],
],
],
// Other
'powered_by' => ':app Status-Seite via <a href="https://cachethq.io">Cachet</a>.',
'about_this_site' => 'Über diese Seite',

View File

@ -58,6 +58,35 @@ return [
],
],
// Subscriber
'subscriber' => [
'subscribe' => 'Subscribe to get the most recent updates.',
'button' => 'Subscribe',
'email' => [
'subscribe' => 'Subscribe to email updates.',
'subscribed' => 'You\'ve been subscribed to email notifications, please check your email to confirm your subscription.',
'verified' => 'Your email subscription has been confirmed. Thank you!',
'unsubscribe' => 'Unsuscribe from email updates.',
'unsubscribed' => 'Your email subscription has been cancelled.',
'failure' => 'Something went wrong with the subscription.',
'verify' => [
'text' => "Please confirm your email subscription to :app_name status updates.\n:link\nThank you, :app_name",
'html-preheader' => 'Please confirm your email subscription to :app_name status updates.',
'html' => '<p>Please confirm your email subscription to :app_name status updates.</p><p>:link</p><p>Thank you, :app_name</p>',
],
'maintenance' => [
'text' => "New maintenance has been scheduled on :app_name.\nThank you, :app_name",
'html-preheader' => 'New maintenance has been scheduled on :app_name.',
'html' => '<p>New maintenance has been scheduled on :app_name.</p><p>Thank you, :app_name</p>',
],
'incident' => [
'text' => "New incident has been reported on :app_name.\nThank you, :app_name",
'html-preheader' => 'New incident has been reported on :app_name.',
'html' => '<p>New incident has been reported on :app_name.</p><p>Thank you, :app_name</p>',
],
],
],
// Other
'powered_by' => ':app Status Page is powered by <a href="https://cachethq.io">Cachet</a>.',
'about_this_site' => 'About this site',

View File

@ -37,13 +37,14 @@ return [
// Incidents form fields
'incidents' => [
'name' => 'Name',
'status' => 'Status',
'component' => 'Component',
'message' => 'Message',
'message-help' => 'You may also use Markdown.',
'scheduled_at' => 'When to schedule the maintenance for?',
'incident_time' => 'When did this incident occur?',
'name' => 'Name',
'status' => 'Status',
'component' => 'Component',
'message' => 'Message',
'message-help' => 'You may also use Markdown.',
'scheduled_at' => 'When to schedule the maintenance for?',
'incident_time' => 'When did this incident occur?',
'notify_subscribers' => 'Notify subscribers',
'templates' => [
'name' => 'Name',

View File

@ -47,6 +47,44 @@ return [
'revoke' => 'Revocar API Key',
],
// Metrics
'metrics' => [
'filter' => [
'hourly' => 'Hourly',
'daily' => 'Daily',
'monthly' => 'Monthly',
],
],
// Subscriber
'subscriber' => [
'subscribe' => 'Subscribe to get the most recent updates.',
'button' => 'Subscribe',
'email' => [
'subscribe' => 'Subscribe to email updates.',
'subscribed' => 'You\'ve been subscribed to email notifications, please check your email to confirm your subscription.',
'verified' => 'Your email subscription has been confirmed. Thank you!',
'unsubscribe' => 'Unsuscribe from email updates.',
'unsubscribed' => 'Your email subscription has been cancelled.',
'failure' => 'Something went wrong with the subscription.',
'verify' => [
'text' => "Please confirm your email subscription to :app_name status updates.\n:link\nThank you, :app_name",
'html-preheader' => 'Please confirm your email subscription to :app_name status updates.',
'html' => '<p>Please confirm your email subscription to :app_name status updates.</p><p>:link</p><p>Thank you, :app_name</p>',
],
'maintenance' => [
'text' => "New maintenance has been scheduled on :app_name.\nThank you, :app_name",
'html-preheader' => 'New maintenance has been scheduled on :app_name.',
'html' => '<p>New maintenance has been scheduled on :app_name.</p><p>Thank you, :app_name</p>',
],
'incident' => [
'text' => "New incident has been reported on :app_name.\nThank you, :app_name",
'html-preheader' => 'New incident has been reported on :app_name.',
'html' => '<p>New incident has been reported on :app_name.</p><p>Thank you, :app_name</p>',
],
],
],
// Other
'powered_by' => ':app La página de estado es alimentada por <a href="https://cachethq.github.io">Cachet</a>.',
'about_this_site' => 'Acerca de este sitio',

View File

@ -58,6 +58,35 @@ return [
],
],
// Subscriber
'subscriber' => [
'subscribe' => 'Subscribe to get the most recent updates.',
'button' => 'Subscribe',
'email' => [
'subscribe' => 'Subscribe to email updates.',
'subscribed' => 'You\'ve been subscribed to email notifications, please check your email to confirm your subscription.',
'verified' => 'Your email subscription has been confirmed. Thank you!',
'unsubscribe' => 'Unsuscribe from email updates.',
'unsubscribed' => 'Your email subscription has been cancelled.',
'failure' => 'Something went wrong with the subscription.',
'verify' => [
'text' => "Please confirm your email subscription to :app_name status updates.\n:link\nThank you, :app_name",
'html-preheader' => 'Please confirm your email subscription to :app_name status updates.',
'html' => '<p>Please confirm your email subscription to :app_name status updates.</p><p>:link</p><p>Thank you, :app_name</p>',
],
'maintenance' => [
'text' => "New maintenance has been scheduled on :app_name.\nThank you, :app_name",
'html-preheader' => 'New maintenance has been scheduled on :app_name.',
'html' => '<p>New maintenance has been scheduled on :app_name.</p><p>Thank you, :app_name</p>',
],
'incident' => [
'text' => "New incident has been reported on :app_name.\nThank you, :app_name",
'html-preheader' => 'New incident has been reported on :app_name.',
'html' => '<p>New incident has been reported on :app_name.</p><p>Thank you, :app_name</p>',
],
],
],
// Other
'powered_by' => ':app Status Page est propulsé par <a href="https://cachethq.github.io">Cachet</a>.',
'about_this_site' => 'À propos de ce site',

View File

@ -58,6 +58,35 @@ return [
],
],
// Subscriber
'subscriber' => [
'subscribe' => 'Subscribe to get the most recent updates.',
'button' => 'Subscribe',
'email' => [
'subscribe' => 'Subscribe to email updates.',
'subscribed' => 'You\'ve been subscribed to email notifications, please check your email to confirm your subscription.',
'verified' => 'Your email subscription has been confirmed. Thank you!',
'unsubscribe' => 'Unsuscribe from email updates.',
'unsubscribed' => 'Your email subscription has been cancelled.',
'failure' => 'Something went wrong with the subscription.',
'verify' => [
'text' => "Please confirm your email subscription to :app_name status updates.\n:link\nThank you, :app_name",
'html-preheader' => 'Please confirm your email subscription to :app_name status updates.',
'html' => '<p>Please confirm your email subscription to :app_name status updates.</p><p>:link</p><p>Thank you, :app_name</p>',
],
'maintenance' => [
'text' => "New maintenance has been scheduled on :app_name.\nThank you, :app_name",
'html-preheader' => 'New maintenance has been scheduled on :app_name.',
'html' => '<p>New maintenance has been scheduled on :app_name.</p><p>Thank you, :app_name</p>',
],
'incident' => [
'text' => "New incident has been reported on :app_name.\nThank you, :app_name",
'html-preheader' => 'New incident has been reported on :app_name.',
'html' => '<p>New incident has been reported on :app_name.</p><p>Thank you, :app_name</p>',
],
],
],
// Other
'powered_by' => 'Halaman Status :app dibuat dengan <a href="https://cachethq.io">Cachet</a>.',
'about_this_site' => 'Tentang situs ini',

View File

@ -58,6 +58,35 @@ return [
],
],
// Subscriber
'subscriber' => [
'subscribe' => 'Subscribe to get the most recent updates.',
'button' => 'Subscribe',
'email' => [
'subscribe' => 'Subscribe to email updates.',
'subscribed' => 'You\'ve been subscribed to email notifications, please check your email to confirm your subscription.',
'verified' => 'Your email subscription has been confirmed. Thank you!',
'unsubscribe' => 'Unsuscribe from email updates.',
'unsubscribed' => 'Your email subscription has been cancelled.',
'failure' => 'Something went wrong with the subscription.',
'verify' => [
'text' => "Please confirm your email subscription to :app_name status updates.\n:link\nThank you, :app_name",
'html-preheader' => 'Please confirm your email subscription to :app_name status updates.',
'html' => '<p>Please confirm your email subscription to :app_name status updates.</p><p>:link</p><p>Thank you, :app_name</p>',
],
'maintenance' => [
'text' => "New maintenance has been scheduled on :app_name.\nThank you, :app_name",
'html-preheader' => 'New maintenance has been scheduled on :app_name.',
'html' => '<p>New maintenance has been scheduled on :app_name.</p><p>Thank you, :app_name</p>',
],
'incident' => [
'text' => "New incident has been reported on :app_name.\nThank you, :app_name",
'html-preheader' => 'New incident has been reported on :app_name.',
'html' => '<p>New incident has been reported on :app_name.</p><p>Thank you, :app_name</p>',
],
],
],
// Other
'powered_by' => 'De statuspagina van :app is mogelijk gemaakt door <a href="https://cachethq.io">Cachet</a>.',
'about_this_site' => 'Over deze site',

View File

@ -58,6 +58,35 @@ return [
],
],
// Subscriber
'subscriber' => [
'subscribe' => 'Subscribe to get the most recent updates.',
'button' => 'Subscribe',
'email' => [
'subscribe' => 'Subscribe to email updates.',
'subscribed' => 'You\'ve been subscribed to email notifications, please check your email to confirm your subscription.',
'verified' => 'Your email subscription has been confirmed. Thank you!',
'unsubscribe' => 'Unsuscribe from email updates.',
'unsubscribed' => 'Your email subscription has been cancelled.',
'failure' => 'Something went wrong with the subscription.',
'verify' => [
'text' => "Please confirm your email subscription to :app_name status updates.\n:link\nThank you, :app_name",
'html-preheader' => 'Please confirm your email subscription to :app_name status updates.',
'html' => '<p>Please confirm your email subscription to :app_name status updates.</p><p>:link</p><p>Thank you, :app_name</p>',
],
'maintenance' => [
'text' => "New maintenance has been scheduled on :app_name.\nThank you, :app_name",
'html-preheader' => 'New maintenance has been scheduled on :app_name.',
'html' => '<p>New maintenance has been scheduled on :app_name.</p><p>Thank you, :app_name</p>',
],
'incident' => [
'text' => "New incident has been reported on :app_name.\nThank you, :app_name",
'html-preheader' => 'New incident has been reported on :app_name.',
'html' => '<p>New incident has been reported on :app_name.</p><p>Thank you, :app_name</p>',
],
],
],
// Other
'powered_by' => ':app Status Page is powered by <a href="https://cachethq.io">Cachet</a>.',
'about_this_site' => 'O tej stronie',

View File

@ -58,6 +58,35 @@ return [
],
],
// Subscriber
'subscriber' => [
'subscribe' => 'Subscribe to get the most recent updates.',
'button' => 'Subscribe',
'email' => [
'subscribe' => 'Subscribe to email updates.',
'subscribed' => 'You\'ve been subscribed to email notifications, please check your email to confirm your subscription.',
'verified' => 'Your email subscription has been confirmed. Thank you!',
'unsubscribe' => 'Unsuscribe from email updates.',
'unsubscribed' => 'Your email subscription has been cancelled.',
'failure' => 'Something went wrong with the subscription.',
'verify' => [
'text' => "Please confirm your email subscription to :app_name status updates.\n:link\nThank you, :app_name",
'html-preheader' => 'Please confirm your email subscription to :app_name status updates.',
'html' => '<p>Please confirm your email subscription to :app_name status updates.</p><p>:link</p><p>Thank you, :app_name</p>',
],
'maintenance' => [
'text' => "New maintenance has been scheduled on :app_name.\nThank you, :app_name",
'html-preheader' => 'New maintenance has been scheduled on :app_name.',
'html' => '<p>New maintenance has been scheduled on :app_name.</p><p>Thank you, :app_name</p>',
],
'incident' => [
'text' => "New incident has been reported on :app_name.\nThank you, :app_name",
'html-preheader' => 'New incident has been reported on :app_name.',
'html' => '<p>New incident has been reported on :app_name.</p><p>Thank you, :app_name</p>',
],
],
],
// Other
'powered_by' => ':app Esta Status Page é fornecida por <a href="https://cachethq.github.io">Cachet</a>.',
'about_this_site' => 'Sobre este site',

View File

@ -58,6 +58,35 @@ return [
],
],
// Subscriber
'subscriber' => [
'subscribe' => 'Subscribe to get the most recent updates.',
'button' => 'Subscribe',
'email' => [
'subscribe' => 'Subscribe to email updates.',
'subscribed' => 'You\'ve been subscribed to email notifications, please check your email to confirm your subscription.',
'verified' => 'Your email subscription has been confirmed. Thank you!',
'unsubscribe' => 'Unsuscribe from email updates.',
'unsubscribed' => 'Your email subscription has been cancelled.',
'failure' => 'Something went wrong with the subscription.',
'verify' => [
'text' => "Please confirm your email subscription to :app_name status updates.\n:link\nThank you, :app_name",
'html-preheader' => 'Please confirm your email subscription to :app_name status updates.',
'html' => '<p>Please confirm your email subscription to :app_name status updates.</p><p>:link</p><p>Thank you, :app_name</p>',
],
'maintenance' => [
'text' => "New maintenance has been scheduled on :app_name.\nThank you, :app_name",
'html-preheader' => 'New maintenance has been scheduled on :app_name.',
'html' => '<p>New maintenance has been scheduled on :app_name.</p><p>Thank you, :app_name</p>',
],
'incident' => [
'text' => "New incident has been reported on :app_name.\nThank you, :app_name",
'html-preheader' => 'New incident has been reported on :app_name.',
'html' => '<p>New incident has been reported on :app_name.</p><p>Thank you, :app_name</p>',
],
],
],
// Other
'powered_by' => ':app 应用状态页面由 <a href="https://cachethq.io">Cachet</a>提供支持。',
'about_this_site' => '关于此站点',

View File

@ -58,6 +58,35 @@ return [
],
],
// Subscriber
'subscriber' => [
'subscribe' => 'Subscribe to get the most recent updates.',
'button' => 'Subscribe',
'email' => [
'subscribe' => 'Subscribe to email updates.',
'subscribed' => 'You\'ve been subscribed to email notifications, please check your email to confirm your subscription.',
'verified' => 'Your email subscription has been confirmed. Thank you!',
'unsubscribe' => 'Unsuscribe from email updates.',
'unsubscribed' => 'Your email subscription has been cancelled.',
'failure' => 'Something went wrong with the subscription.',
'verify' => [
'text' => "Please confirm your email subscription to :app_name status updates.\n:link\nThank you, :app_name",
'html-preheader' => 'Please confirm your email subscription to :app_name status updates.',
'html' => '<p>Please confirm your email subscription to :app_name status updates.</p><p>:link</p><p>Thank you, :app_name</p>',
],
'maintenance' => [
'text' => "New maintenance has been scheduled on :app_name.\nThank you, :app_name",
'html-preheader' => 'New maintenance has been scheduled on :app_name.',
'html' => '<p>New maintenance has been scheduled on :app_name.</p><p>Thank you, :app_name</p>',
],
'incident' => [
'text' => "New incident has been reported on :app_name.\nThank you, :app_name",
'html-preheader' => 'New incident has been reported on :app_name.',
'html' => '<p>New incident has been reported on :app_name.</p><p>Thank you, :app_name</p>',
],
],
],
// Other
'powered_by' => ':app 狀態頁是由 <a href="https://cachethq.io">Cachet</a> 提供。',
'about_this_site' => '關於本站',

View File

@ -99,6 +99,11 @@
<input type="text" name="incident[created_at]" class="form-control" rel="datepicker-any">
<span class="help-block">{{ trans('forms.optional') }}</span>
</div>
<div class="form-group">
<label>{{ trans('forms.incidents.notify_subscribers') }}</label>
<input type="checkbox" name="incident[notify]" value="1" checked="{{ Input::old('incident.message', 'checked') }}">
<span class="help-block">{{ trans('forms.optional') }}</span>
</div>
</fieldset>
<div class="form-group">

View File

@ -42,6 +42,11 @@
<label>{{ trans('forms.incidents.scheduled_at') }}</label>
<input type="text" name="incident[scheduled_at]" class="form-control" rel="datepicker" required>
</div>
<div class="form-group">
<label>{{ trans('forms.incidents.notify_subscribers') }}</label>
<input type="checkbox" name="incident[notify]" value="1" checked="{{ Input::old('incident.message', 'checked') }}">
<span class="help-block">{{ trans('forms.optional') }}</span>
</div>
</fieldset>
<div class="form-group">

View File

@ -0,0 +1,24 @@
@extends('layout.emails')
@section('preheader')
{!! trans('cachet.subscriber.email.maintenance.html-preheader', ['app_name' => Setting::get('app_name')]) !!}
@stop
@section('content')
{!! trans('cachet.subscriber.email.maintenance.html', ['app_name' => Setting::get('app_name')]) !!}
<p>
{!! $status !!}
</p>
<p>
{!! $htmlContent !!}
</p>
@if(Setting::get('show_support'))
<p>{!! trans('cachet.powered_by', ['app' => Setting::get('app_name')]) !!}</p>
@endif
<p>
<small><a href="{{ route('unsubscribe', $token) }}">{!! trans('cachet.subscriber.email.unsuscribe') !!}</a></small>
</p>
@stop

View File

@ -0,0 +1,11 @@
{!! trans('cachet.subscriber.email.maintenance.text', ['app_name' => Setting::get('app_name')]) !!}
{!! $status !!}
{!! $textContent !!}
@if(Setting::get('show_support'))
{!! trans('cachet.powered_by', ['app' => Setting::get('app_name')]) !!}
@endif
{!! trans('cachet.subscriber.email.unsuscribe') !!} {{ route('unsubscribe', $token) }}

View File

@ -0,0 +1,24 @@
@extends('layout.emails')
@section('preheader')
{!! trans('cachet.subscriber.email.incident.html-preheader', ['app_name' => Setting::get('app_name')]) !!}
@stop
@section('content')
{!! trans('cachet.subscriber.email.incident.html-preheader', ['app_name' => Setting::get('app_name')]) !!}
<p>
{!! $status !!}
</p>
<p>
{!! $htmlContent !!}
</p>
@if(Setting::get('show_support'))
<p>{!! trans('cachet.powered_by', ['app' => Setting::get('app_name')]) !!}</p>
@endif
<p>
<small><a href="{{ route('unsubscribe', $token) }}">{!! trans('cachet.subscriber.email.unsuscribe') !!}</a></small>
</p>
@stop

View File

@ -0,0 +1,11 @@
{!! trans('cachet.subscriber.email.incident.text', ['app_name' => Setting::get('app_name')]) !!}
{!! $status !!}
{!! $textContent !!}
@if(Setting::get('show_support'))
{!! trans('cachet.powered_by', ['app' => Setting::get('app_name')]) !!}
@endif
{!! trans('cachet.subscriber.email.unsuscribe') !!} {{ route('unsubscribe', $token) }}

View File

@ -0,0 +1,13 @@
@extends('layout.emails')
@section('preheader')
{!! trans('cachet.subscriber.email.verify.html-preheader') !!}
@stop
@section('content')
{!! trans('cachet.subscriber.email.verify.html', ['app_name' => Setting::get('app_name'), 'link' => $link]) !!}
@if(Setting::get('show_support'))
<p>{!! trans('cachet.powered_by', ['app' => Setting::get('app_name')]) !!}</p>
@endif
@stop

View File

@ -0,0 +1,5 @@
{{ trans('cachet.subscriber.email.verify.text', ['app_name' => Setting::get('app_name'), 'link' => $link]) }}
@if(Setting::get('show_support'))
{!! trans('cachet.powered_by', ['app' => Setting::get('app_name')]) !!}
@endif

View File

@ -1,6 +1,14 @@
@extends('layout.master')
@section('content')
<div class="pull-right">
<p><a class="btn btn-success btn-outline" href="{{ route('subscribe') }}">{{ trans('cachet.subscriber.button') }}</a></p>
</div>
<div class="clearfix"></div>
@include('partials.dashboard.errors')
@if($bannerImage = Setting::get('app_banner'))
<div class="row app-banner">
<div class="col-md-12 text-center">

View File

@ -4,7 +4,7 @@
<meta charset="utf-8"> <!-- utf-8 works for most cases -->
<meta name="viewport" content="width=device-width"> <!-- Forcing initial-scale shouldn't be necessary -->
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Use the latest (edge) version of IE rendering engine -->
<title>CachetHQ</title> <!-- the <title> tag shows on email notifications on Android 4.4. -->
<title>{{ Setting::get('app_name') }} Status</title> <!-- the <title> tag shows on email notifications on Android 4.4. -->
<style type="text/css">
/* ensure that clients don't add any padding or spaces around the email design and allow us to style emails for the entire width of the preview pane */
@ -107,7 +107,7 @@
<td>
<!-- Hidden Preheader Text : BEGIN -->
<div style="display:none; visibility:hidden; opacity:0; color:transparent; height:0; width:0;line-height:0; overflow:hidden;mso-hide: all;">
Visually hidden preheader text.
@yield('preheader')
</div>
<!-- Hidden Preheader Text : END -->
@ -125,11 +125,13 @@
<tr>
<td>
<table border="0" width="100%" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
@if($bannerImage = Setting::get('app_banner'))
<tr>
<td bgcolor="#F0F3F4" style="padding: 40px; font-family: sans-serif; font-size: 20px; line-height: 27px; color: #666666; text-align: center;">
<img src="{{ $message->embed('img/cachet-logo.svg') }}" width="300" alt="CachetHQ">
</td>
<td bgcolor="#F0F3F4" style="padding: 40px; font-family: sans-serif; font-size: 20px; line-height: 27px; color: #666666; text-align: center;">
<a href="{{ $appUrl }}"><img src="data:{{ $bannerType }};base64, {{ $bannerImage}}" class="banner-image img-responsive"></a>
</td>
</tr>
@endif
<tr>
<td>
<!-- 2 x 2 grid : BEGIN -->
@ -148,16 +150,6 @@
</table>
</td>
</tr>
<!-- Footer : BEGIN -->
<tr>
<td style="text-align: center;padding: 40px 0;font-family: sans-serif; font-size: 12px; line-height: 18px;color: #888888;">
If you no longer wish to receive these emails, you can <unsubscribe style="color: #444444; padding: 0;text-decoration: underline">unsubscribe</unsubscribe>.<br>
Company Name &bull; 123 Fake Street, SpringField, Oregon 97477 US &bull; <span class="mobile_link">(123) 456-7890</span><br><br>
</td>
</tr>
<!-- Footer : END -->
</table>
<!-- Email wrapper : END -->

View File

@ -0,0 +1,37 @@
@extends('layout.master')
@section('content')
@if($bannerImage = Setting::get('app_banner'))
<div class="row app-banner">
<div class="col-md-12 text-center">
<?php $bannerType = Setting::get('app_banner_type') ?>
@if($appUrl = Setting::get('app_domain'))
<a href="{{ $appUrl }}"><img src="data:{{ $bannerType }};base64, {{ $bannerImage}}" class="banner-image img-responsive"></a>
@else
<img src="data:{{ $bannerType }};base64, {{ $bannerImage}}" class="banner-image img-responsive">
@endif
</div>
</div>
@endif
@if($aboutApp)
<div class="about-app">
<h1>{{ trans('cachet.about_this_site') }}</h1>
<p>{!! $aboutApp !!}</p>
</div>
@endif
@include('partials.dashboard.errors')
<h1>{{ trans('cachet.subscriber.subscribe') }}</h1>
<form action="{{ route('subscribe') }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="form-group">
<label for="email">{{ trans('cachet.subscriber.email.subscribe') }}</label>
<input class="form-control" type="text" name="email">
</div>
<div class="form-group">
<input class="btn btn-success btn-outline" type="submit" value="{{ trans('cachet.subscriber.button') }}">
</div>
</form>
@stop