Allow setting of 0 incident days. Closes #920

This commit is contained in:
James Brooks
2015-08-18 21:27:09 +01:00
parent d47121b93d
commit 885c17054f
3 changed files with 11 additions and 3 deletions

View File

@@ -48,8 +48,13 @@ class StatusPageController extends Controller
}
}
$daysToShow = Setting::get('app_incident_days') ?: 7;
$incidentDays = range(0, $daysToShow - 1);
$daysToShow = Setting::get('app_incident_days', 0) - 1;
if ($daysToShow < 0) {
$daysToShow = 0;
$incidentDays = [];
} else {
$incidentDays = range(0, $daysToShow);
}
$dateTimeZone = Setting::get('app_timezone');
$incidentVisiblity = Auth::check() ? 0 : 1;
@@ -77,6 +82,7 @@ class StatusPageController extends Controller
}, SORT_REGULAR, true)->all();
return View::make('index')
->withDaysToShow($daysToShow)
->withAllIncidents($allIncidents)
->withAboutApp(Markdown::convertToHtml(Setting::get('app_about')))
->withCanPageForward((bool) $today->gt($startDate))

View File

@@ -135,7 +135,7 @@
<div class="col-xs-12">
<div class="form-group">
<label>{{ trans('forms.settings.app-setup.days-of-incidents') }}</label>
<input type="number" min="1" max="100" name="app_incident_days" class="form-control" value="{{ Setting::get('app_incident_days') ?: 7 }}">
<input type="number" max="100" name="app_incident_days" class="form-control" value="{{ Setting::get('app_incident_days', 7) }}">
</div>
</div>
</div>

View File

@@ -55,6 +55,7 @@
</div>
@endif
@if($days_to_show > 0)
<div class="section-timeline">
<h1>{{ trans('cachet.incidents.past') }}</h1>
@foreach($all_incidents as $date => $incidents)
@@ -80,4 +81,5 @@
@endif
</ul>
</nav>
@endif
@stop