diff --git a/app/Foundation/Exceptions/Displayers/MaintenanceDisplayer.php b/app/Foundation/Exceptions/Displayers/MaintenanceDisplayer.php new file mode 100644 index 00000000..77c583f7 --- /dev/null +++ b/app/Foundation/Exceptions/Displayers/MaintenanceDisplayer.php @@ -0,0 +1,104 @@ + + */ +class MaintenanceDisplayer implements DisplayerInterface +{ + /** + * The view factory instance. + * + * @var \Illuminate\Contracts\View\Factory + */ + protected $view; + + /** + * Create a new maintenance displayer instance. + * + * @param \Illuminate\Contracts\View\Factory $view + * + * @return void + */ + public function __construct(Factory $view) + { + $this->view = $view; + } + + /** + * Get the error response associated with the given exception. + * + * @param \Exception $exception + * @param string $id + * @param int $code + * @param string[] $headers + * + * @return \Symfony\Component\HttpFoundation\Response + */ + public function display(Exception $exception, $id, $code, array $headers) + { + return new Response($this->render(), $code, array_merge($headers, ['Content-Type' => $this->contentType()])); + } + + /** + * Render the page. + * + * @return string + */ + protected function render() + { + return $this->view->make('errors.maintenance')->render(); + } + + /** + * Get the supported content type. + * + * @return string + */ + public function contentType() + { + return 'text/html'; + } + + /** + * Can we display the exception? + * + * @param \Exception $original + * @param \Exception $transformed + * @param int $code + * + * @return bool + */ + public function canDisplay(Exception $original, Exception $transformed, $code) + { + return $transformed instanceof MaintenanceModeException; + } + + /** + * Do we provide verbose information about the exception? + * + * @return bool + */ + public function isVerbose() + { + return false; + } +} diff --git a/app/Foundation/Providers/ComposerServiceProvider.php b/app/Foundation/Providers/ComposerServiceProvider.php index b1cc0844..19ca8fc2 100644 --- a/app/Foundation/Providers/ComposerServiceProvider.php +++ b/app/Foundation/Providers/ComposerServiceProvider.php @@ -38,7 +38,7 @@ class ComposerServiceProvider extends ServiceProvider { $factory->composer('*', AppComposer::class); $factory->composer('*', CurrentUserComposer::class); - $factory->composer(['index', 'single-incident', 'subscribe.*', 'signup', 'dashboard.settings.theme', 'notifications::email', 'single-schedule'], ThemeComposer::class); + $factory->composer(['index', 'single-incident', 'subscribe.*', 'signup', 'dashboard.settings.theme', 'notifications::email', 'single-schedule', 'errors.*'], ThemeComposer::class); $factory->composer('dashboard.*', DashboardComposer::class); $factory->composer(['setup.*', 'dashboard.settings.localization'], TimezoneLocaleComposer::class); diff --git a/config/exceptions.php b/config/exceptions.php index d084355e..d3187890 100644 --- a/config/exceptions.php +++ b/config/exceptions.php @@ -50,6 +50,7 @@ return [ 'CachetHQ\Cachet\Foundation\Exceptions\Displayers\JsonValidationDisplayer', 'CachetHQ\Cachet\Foundation\Exceptions\Displayers\RedirectDisplayer', 'CachetHQ\Cachet\Foundation\Exceptions\Displayers\ThrottleDisplayer', + 'CachetHQ\Cachet\Foundation\Exceptions\Displayers\MaintenanceDisplayer', 'GrahamCampbell\Exceptions\Displayers\DebugDisplayer', 'GrahamCampbell\Exceptions\Displayers\HtmlDisplayer', 'GrahamCampbell\Exceptions\Displayers\JsonDisplayer', diff --git a/resources/views/errors/maintenance.blade.php b/resources/views/errors/maintenance.blade.php new file mode 100644 index 00000000..a625cc77 --- /dev/null +++ b/resources/views/errors/maintenance.blade.php @@ -0,0 +1,12 @@ +@extends('layout.master') + +@section('content') +
+
+ Under Maintenance +
+
+

We're currently under maintnenance, come back shortly.

+
+
+@stop diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index f2534889..07742bb4 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -3,3 +3,7 @@ @section('content') @modules @stop + +@section('bottom-content') +@include('partials.footer') +@stop diff --git a/resources/views/layout/master.blade.php b/resources/views/layout/master.blade.php index ba5a12e4..422ff14f 100644 --- a/resources/views/layout/master.blade.php +++ b/resources/views/layout/master.blade.php @@ -76,6 +76,6 @@ @yield('content') - @include('partials.footer') + @yield('bottom-content') diff --git a/resources/views/signup.blade.php b/resources/views/signup.blade.php index e8e2aeb4..a81a4562 100644 --- a/resources/views/signup.blade.php +++ b/resources/views/signup.blade.php @@ -45,3 +45,7 @@ @stop + +@section('bottom-content') +@include('partials.footer') +@stop diff --git a/resources/views/single-incident.blade.php b/resources/views/single-incident.blade.php index b576bccc..f05bfbd3 100644 --- a/resources/views/single-incident.blade.php +++ b/resources/views/single-incident.blade.php @@ -43,3 +43,7 @@ @endif @stop + +@section('bottom-content') +@include('partials.footer') +@stop diff --git a/resources/views/single-schedule.blade.php b/resources/views/single-schedule.blade.php index f85095d8..c47851aa 100644 --- a/resources/views/single-schedule.blade.php +++ b/resources/views/single-schedule.blade.php @@ -33,3 +33,7 @@ @stop + +@section('bottom-content') +@include('partials.footer') +@stop