Skip to content

Commit

Permalink
Option to only show disrupted days. Closes #2088
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrooksuk committed Oct 4, 2016
1 parent 0646b6b commit 179de1f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/Composers/AppComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,6 @@ public function compose(View $view)
$view->withTimezone($this->dates->getTimezone());
$view->withSiteTitle($this->config->get('setting.app_name'));
$view->withFontSubset($this->config->get('langs.'.$this->config->get('app.locale').'.subset', 'latin'));
$view->withOnlyDisruptedDays($this->config->get('setting.only_disrupted_days'));
}
}
10 changes: 6 additions & 4 deletions app/Http/Controllers/StatusPageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ public function showIndex()
});

// Add in days that have no incidents
foreach ($incidentDays as $i) {
$date = app(DateFactory::class)->make($startDate)->subDays($i);
if (Config::get('setting.only_disrupted_days') === false) {
foreach ($incidentDays as $i) {
$date = app(DateFactory::class)->make($startDate)->subDays($i);

if (!isset($allIncidents[$date->toDateString()])) {
$allIncidents[$date->toDateString()] = [];
if (!isset($allIncidents[$date->toDateString()])) {
$allIncidents[$date->toDateString()] = [];
}
}
}

Expand Down
11 changes: 11 additions & 0 deletions config/setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,15 @@
*/

'skip_subscriber_verification' => false,

/*
|--------------------------------------------------------------------------
| Only disrupted days
|--------------------------------------------------------------------------
|
| Whether to only show days with incidents, or each day in the timeline.
|
*/

'only_disrupted_days' => false,
];
1 change: 1 addition & 0 deletions resources/lang/en/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
'automatic_localization' => 'Automatically localise your status page to your visitor\'s language?',
'enable_external_dependencies' => 'Enable Third Party Dependencies (Google Fonts, Trackers, etc...)',
'show_timezone' => 'Show the timezone the status page is running in.',
'only_disrupted_days' => 'Only show days containing incidents in the timeline?',
],
'analytics' => [
'analytics_google' => 'Google Analytics code',
Expand Down
11 changes: 11 additions & 0 deletions resources/views/dashboard/settings/app-setup.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="checkbox">
<label>
<input type="hidden" value="0" name="only_disrupted_days">
<input type="checkbox" value="1" name="only_disrupted_days" {{ $only_disrupted_days ? 'checked' : null }}>
{{ trans('forms.settings.app-setup.only_disrupted_days') }}
</label>
</div>
</div>
</div>
</fieldset>

<div class="row">
Expand Down

0 comments on commit 179de1f

Please sign in to comment.