Display an Incident and Component count in the sidebar.

This commit is contained in:
James Brooks
2015-03-05 19:53:32 +00:00
parent 9db90c1b81
commit b1746d1b9e
6 changed files with 39 additions and 2 deletions

View File

@@ -85,6 +85,16 @@ body.dashboard {
&:hover {
text-decoration: none;
}
span {
&.label {
float: right;
margin: 6px 0;
&.label-info {
background-color: $cachet-primary;
}
}
}
}
&.sub-nav-item {

View File

@@ -39,6 +39,7 @@
<a href="{{ route('dashboard.incidents') }}">
<i class="icon ion-android-alert"></i>
<span>{{ trans('dashboard.incidents.incidents') }}</span>
<span class="label label-info">{{ $incidentCount }}</span>
</a>
</li>
<li {{ set_active('dashboard/templates*') }}>
@@ -51,6 +52,7 @@
<a href="{{ route('dashboard.components') }}">
<i class="icons ion-outlet"></i>
<span>{{ trans('dashboard.components.components') }}</span>
<span class="label label-info">{{ $componentCount }}</span>
</a>
</li>
<li {{ set_active('dashboard/team*') }}>

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
{
"dist/css/all.css": "dist/css/all-d43ec06b.css",
"dist/css/all.css": "dist/css/all-fc4d5c76.css",
"dist/js/all.js": "dist/js/all-d4baa2f5.js"
}

View File

@@ -0,0 +1,24 @@
<?php
namespace CachetHQ\Cachet\Composers;
use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Cachet\Models\Component;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
class DashboardComposer
{
/**
* Bind data to the view.
*
* @param \Illuminate\View\View $view
*
* @return void
*/
public function compose(View $view)
{
$view->with('incidentCount', Incident::notScheduled()->count());
$view->with('componentCount', Component::all()->count());
}
}

View File

@@ -25,6 +25,7 @@ class ViewComposerServiceProvider extends ServiceProvider
{
$this->app->view->composer('*', 'CachetHQ\Cachet\Composers\LoggedUserComposer');
$this->app->view->composer('index', 'CachetHQ\Cachet\Composers\IndexComposer');
$this->app->view->composer('dashboard.*', 'CachetHQ\Cachet\Composers\DashboardComposer');
$this->app->view->composer([
'setup',
'dashboard.settings.app-setup',