From c3646fd64a29cd19ef0beaec50964ca506c3cd0e Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sat, 17 Oct 2015 14:27:15 +0100 Subject: [PATCH] Let's not duplicate view code --- app/Composers/AppComposer.php | 2 ++ app/Http/Controllers/StatusPageController.php | 2 -- resources/views/incident.blade.php | 19 +----------------- resources/views/index.blade.php | 20 +------------------ resources/views/partials/about-app.blade.php | 19 ++++++++++++++++++ 5 files changed, 23 insertions(+), 39 deletions(-) create mode 100644 resources/views/partials/about-app.blade.php diff --git a/app/Composers/AppComposer.php b/app/Composers/AppComposer.php index 01a4dc2e..da5e3e95 100644 --- a/app/Composers/AppComposer.php +++ b/app/Composers/AppComposer.php @@ -12,6 +12,7 @@ namespace CachetHQ\Cachet\Composers; use CachetHQ\Cachet\Facades\Setting; +use GrahamCampbell\Markdown\Facades\Markdown; use Illuminate\Contracts\View\View; class AppComposer @@ -30,5 +31,6 @@ class AppComposer $mailFrom = env('MAIL_NAME', false); $view->withSubscribersEnabled($isEnabled && $mailAddress && $mailFrom); + $view->withAboutApp(Markdown::convertToHtml(Setting::get('app_about'))); } } diff --git a/app/Http/Controllers/StatusPageController.php b/app/Http/Controllers/StatusPageController.php index 231b234d..6126f31a 100644 --- a/app/Http/Controllers/StatusPageController.php +++ b/app/Http/Controllers/StatusPageController.php @@ -15,7 +15,6 @@ use CachetHQ\Cachet\Facades\Setting; use CachetHQ\Cachet\Models\Incident; use Exception; use GrahamCampbell\Binput\Facades\Binput; -use GrahamCampbell\Markdown\Facades\Markdown; use Illuminate\Routing\Controller; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\View; @@ -90,7 +89,6 @@ class StatusPageController extends Controller return View::make('index') ->withDaysToShow($daysToShow) ->withAllIncidents($allIncidents) - ->withAboutApp(Markdown::convertToHtml(Setting::get('app_about'))) ->withCanPageForward((bool) $today->gt($startDate)) ->withCanPageBackward(Incident::notScheduled()->where('created_at', '<', $startDate->format('Y-m-d'))->count() > 0) ->withPreviousDate($startDate->copy()->subDays($daysToShow)->toDateString()) diff --git a/resources/views/incident.blade.php b/resources/views/incident.blade.php index 7b4c5781..eb80a5d1 100644 --- a/resources/views/incident.blade.php +++ b/resources/views/incident.blade.php @@ -1,28 +1,11 @@ @extends('layout.master') @section('content') -
- -
- -
-
@include('dashboard.partials.errors')
-@if($bannerImage = Setting::get('app_banner')) -
-
- - @if($app_url = Setting::get('app_domain')) - - @else - - @endif -
-
-@endif +@include('partials.about-app')

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

diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index fd4f8817..b3fca4ba 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -5,25 +5,7 @@ @include('dashboard.partials.errors') -@if($bannerImage = Setting::get('app_banner')) -
-
- - @if($app_url = Setting::get('app_domain')) - - @else - - @endif -
-
-@endif - -@if($about_app) -
-

{{ trans('cachet.about_this_site') }}

-

{!! $about_app !!}

-
-@endif +@include('partials.about-app')
{{ $systemMessage }}
diff --git a/resources/views/partials/about-app.blade.php b/resources/views/partials/about-app.blade.php new file mode 100644 index 00000000..48aaa011 --- /dev/null +++ b/resources/views/partials/about-app.blade.php @@ -0,0 +1,19 @@ +@if($bannerImage = Setting::get('app_banner')) +
+
+ + @if($app_url = Setting::get('app_domain')) + + @else + + @endif +
+
+@endif + +@if($about_app) +
+

{{ trans('cachet.about_this_site') }}

+

{!! $about_app !!}

+
+@endif