From 8a3f9196d3acee4b9aefa4cf00bd3f397d87a653 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sat, 15 Aug 2015 15:10:20 +0100 Subject: [PATCH] Linking directly to an individual incident --- app/Http/Controllers/StatusPageController.php | 3 +- app/Http/Routes/StatusPageRoutes.php | 4 +-- app/Providers/ComposerServiceProvider.php | 4 +-- resources/assets/sass/_status-page.scss | 22 ++++++------- resources/views/incident.blade.php | 33 +++++++++++++++++++ resources/views/partials/incident.blade.php | 25 ++++++++++++++ resources/views/partials/incidents.blade.php | 23 +------------ 7 files changed, 76 insertions(+), 38 deletions(-) create mode 100644 resources/views/incident.blade.php create mode 100644 resources/views/partials/incident.blade.php diff --git a/app/Http/Controllers/StatusPageController.php b/app/Http/Controllers/StatusPageController.php index 842d5fbb..42690c8d 100644 --- a/app/Http/Controllers/StatusPageController.php +++ b/app/Http/Controllers/StatusPageController.php @@ -94,6 +94,7 @@ class StatusPageController extends Controller */ public function showIncident(Incident $incident) { - + return View::make('incident') + ->withIncident($incident); } } diff --git a/app/Http/Routes/StatusPageRoutes.php b/app/Http/Routes/StatusPageRoutes.php index 8add5d1a..d047a713 100644 --- a/app/Http/Routes/StatusPageRoutes.php +++ b/app/Http/Routes/StatusPageRoutes.php @@ -33,12 +33,12 @@ class StatusPageRoutes ], function ($router) { $router->get('/', [ 'as' => 'status-page', - 'uses' => 'HomeController@showIndex', + 'uses' => 'StatusPageController@showIndex', ]); $router->get('incident/{incident}', [ 'as' => 'incident', - 'uses' => 'HomeController@showIncident', + 'uses' => 'StatusPageController@showIncident', ]); }); } diff --git a/app/Providers/ComposerServiceProvider.php b/app/Providers/ComposerServiceProvider.php index 31ea6437..872f19c9 100644 --- a/app/Providers/ComposerServiceProvider.php +++ b/app/Providers/ComposerServiceProvider.php @@ -33,8 +33,8 @@ class ComposerServiceProvider extends ServiceProvider $factory->composer('*', AppComposer::class); $factory->composer('*', CurrentUserComposer::class); $factory->composer(['index'], MetricsComposer::class); - $factory->composer(['index', 'subscribe'], StatusPageComposer::class); - $factory->composer(['index', 'subscribe'], ThemeComposer::class); + $factory->composer(['index', 'incident', 'subscribe'], StatusPageComposer::class); + $factory->composer(['index', 'incident', 'subscribe'], ThemeComposer::class); $factory->composer('dashboard.*', DashboardComposer::class); $factory->composer(['setup', 'dashboard.settings.app-setup'], TimezoneLocaleComposer::class); } diff --git a/resources/assets/sass/_status-page.scss b/resources/assets/sass/_status-page.scss index 92af695d..e765aefb 100755 --- a/resources/assets/sass/_status-page.scss +++ b/resources/assets/sass/_status-page.scss @@ -16,6 +16,17 @@ body.status-page { margin-bottom: 20px; } + img { + box-sizing: border-box; + + &.emoji { + height: 20px; + width: 20px; + vertical-align: middle; + max-width: none; + } + } + .tooltip { .tooltip-inner { padding: 8px 12px; @@ -231,17 +242,6 @@ body.status-page { font-size: 1.1em; } } - - img { - box-sizing: border-box; - - &.emoji { - height: 20px; - width: 20px; - vertical-align: middle; - max-width: none; - } - } } } } diff --git a/resources/views/incident.blade.php b/resources/views/incident.blade.php new file mode 100644 index 00000000..0a1e0be5 --- /dev/null +++ b/resources/views/incident.blade.php @@ -0,0 +1,33 @@ +@extends('layout.master') + +@section('content') +
+ @if($subscribersEnabled) +

{{ trans('cachet.subscriber.button') }}

+ @endif +

+
+ +
+ +
+ @include('dashboard.partials.errors') +
+ + @if($bannerImage = Setting::get('app_banner')) +
+
+ + @if($app_url = Setting::get('app_domain')) + + @else + + @endif +
+
+ @endif + +

{{ formatted_date($incident->created_at) }}

+ + @include('partials.incident', ['incident' => $incident, 'with_link' => false]) +@stop diff --git a/resources/views/partials/incident.blade.php b/resources/views/partials/incident.blade.php new file mode 100644 index 00000000..223301b8 --- /dev/null +++ b/resources/views/partials/incident.blade.php @@ -0,0 +1,25 @@ +
+
+ @if($current_user) + + @endif + @if($incident->component) + {{ $incident->component->name }} + @endif + {{ $incident->name }}{{ $incident->isScheduled ? trans("cachet.incidents.scheduled_at", ["timestamp" => $incident->scheduled_at_diff]) : null }} +
+ + @if($with_link) + + @else + + @endif + +
+
+ {!! $incident->formattedMessage !!} +
+
diff --git a/resources/views/partials/incidents.blade.php b/resources/views/partials/incidents.blade.php index 83b2c71d..9857cef5 100644 --- a/resources/views/partials/incidents.blade.php +++ b/resources/views/partials/incidents.blade.php @@ -10,28 +10,7 @@
-
-
- @if($current_user) - - @endif - @if($incident->component) - {{ $incident->component->name }} - @endif - {{ $incident->name }}{{ $incident->isScheduled ? trans("cachet.incidents.scheduled_at", ["timestamp" => $incident->scheduled_at_diff]) : null }} -
- - - - -
-
- {!! $incident->formattedMessage !!} -
-
+ @include('partials.incident', ['incident' => $incident, 'with_link' => true])