Let's not duplicate view code

This commit is contained in:
James Brooks
2015-10-17 14:27:15 +01:00
parent 4e7d4c4581
commit c3646fd64a
5 changed files with 23 additions and 39 deletions

View File

@@ -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')));
}
}

View File

@@ -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())

View File

@@ -1,28 +1,11 @@
@extends('layout.master')
@section('content')
<div class="btn-group pull-right">
<a href="/" class="btn btn-info"><i class="ion-home"></i></a>
</div>
<div class="clearfix"></div>
<div class="section-messages">
@include('dashboard.partials.errors')
</div>
@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($app_url = Setting::get('app_domain'))
<a href="{{ $app_url }}" class="links"><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
@include('partials.about-app')
<h4>{{ formatted_date($incident->created_at) }}</h4>

View File

@@ -5,25 +5,7 @@
@include('dashboard.partials.errors')
</div>
@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($app_url = Setting::get('app_domain'))
<a href="{{ $app_url }}"><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($about_app)
<div class="about-app">
<h1>{{ trans('cachet.about_this_site') }}</h1>
<p>{!! $about_app !!}</p>
</div>
@endif
@include('partials.about-app')
<div class="section-status">
<div class="alert alert-{{ $systemStatus }}">{{ $systemMessage }}</div>

View File

@@ -0,0 +1,19 @@
@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($app_url = Setting::get('app_domain'))
<a href="{{ $app_url }}" class="links"><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($about_app)
<div class="about-app">
<h1>{{ trans('cachet.about_this_site') }}</h1>
<p>{!! $about_app !!}</p>
</div>
@endif