Improve dashboard component

This commit is contained in:
James Brooks 2018-06-17 11:29:29 +01:00
parent 1bc2b220d3
commit 394a024f32
3 changed files with 106 additions and 103 deletions

View File

@ -1,8 +1,9 @@
<script>
module.exports = {
props: ['welcome-user'],
props: ['user'],
mounted () {
if (this.welcomeUser) {
if (!this.user.welcomed) {
// @todo Replace this with a non-jquery alternative.
$('#welcome-modal').modal('show');
}
},

View File

@ -1,95 +1,93 @@
@extends('layout.dashboard')
@section('content')
<dashboard inline-template :welcome-user="{{ $welcome_user ? 'true' : 'false' }}">
<div>
<div class="header">
<div class="sidebar-toggler visible-xs">
<i class="ion ion-navicon"></i>
</div>
<span class="uppercase">
<i class="ion ion-speedometer"></i> {{ trans('dashboard.dashboard') }}
</span>
<div>
<div class="header">
<div class="sidebar-toggler visible-xs">
<i class="ion ion-navicon"></i>
</div>
<div class="content-wrapper">
<div class="row">
<div class="col-md-12">
<div class="alert alert-info hidden" id="update-alert">{!! trans('cachet.system.update') !!}</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="section-components no-select">
@if(!$component_groups->isEmpty() || !$ungrouped_components->isEmpty())
@include('dashboard.partials.components')
@else
<ul class="list-group components">
<li class="list-group-item">
<a href="{{ cachet_route('dashboard.components.create') }}">{{ trans('dashboard.components.add.message') }}</a>
</li>
</ul>
@endif
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 col-lg-6">
<div class="stats-widget">
<div class="stats-top">
<span class="stats-value"><a href="{{ cachet_route('dashboard.incidents') }}">{{ $incidents->reduce(function($carry, $incident) { return $carry + count($incident); }) }}</a></span>
<span class="stats-label">{{ trans('dashboard.incidents.incidents') }}</span>
</div>
<div class="stats-chart">
<div class="sparkline" data-type="line" data-resize="true" data-height="80" data-width="100%" data-line-width="2" data-min-spot-color="#e65100" data-max-spot-color="#ffb300" data-line-color="#3498db" data-spot-color="#00838f" data-fill-color="#3498db" data-highlight-line-color="#00acc1" data-highlight-spot-color="#ff8a65" data-spot-radius="false" data-data="[{{ $incidents->map(function ($incident) { return count($incident); } )->implode(',') }}]"></div>
</div>
</div>
</div>
<div class="col-sm-12 col-lg-6">
<div class="stats-widget">
<div class="stats-top">
<span class="stats-value"><a href="{{ cachet_route('dashboard.subscribers') }}">{{ $subscribers->reduce(function($carry, $subscribers) { return $carry + count($subscribers); }) }}</a></span>
<span class="stats-label">{{ trans('dashboard.subscribers.subscribers') }}</span>
</div>
<div class="stats-chart">
<div class="sparkline" data-type="line" data-resize="true" data-height="80" data-width="100%" data-line-width="2" data-min-spot-color="#e65100" data-max-spot-color="#ffb300" data-line-color="#3498db" data-spot-color="#00838f" data-fill-color="#3498db" data-highlight-line-color="#00acc1" data-highlight-spot-color="#ff8a65" data-spot-radius="false" data-data="[{{ $subscribers->map(function ($subscriber) { return count($subscriber); } )->implode(',') }}]"></div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 col-lg-6">
<div class="stats-widget">
<div class="stats-top">
<span class="stats-value">{{ trans('dashboard.widgets.support') }}</span>
<span class="stats-label">{!! trans('dashboard.widgets.support_subtitle') !!}</span>
</div>
</div>
</div>
@if($entries)
<div class="col-sm-12 col-lg-6">
<div class="stats-widget">
<div class='stats-top'>
<span class='stats-value'>{{ trans('dashboard.widgets.news') }}</span>
<span class='stats-label'>{{ trans('dashboard.widgets.news_subtitle') }}</span>
</div>
<div class='stats-body'>
<div class="list-group">
@foreach($entries as $entry)
<a class="list-group-item" href="{{ $entry->link }}" target="_blank">{{ $entry->title }}, <small>{{ $entry->pubDate }}</small> <span class="badge"><i class="ion-android-open"></i></span></a>
@endforeach
</div>
</div>
</div>
</div>
@endif
</div>
</div>
@includeWhen($welcome_user, 'dashboard.partials.welcome-modal')
<span class="uppercase">
<i class="ion ion-speedometer"></i> {{ trans('dashboard.dashboard') }}
</span>
</div>
</dashboard>
<div class="content-wrapper">
<div class="row">
<div class="col-md-12">
<div class="alert alert-info hidden" id="update-alert">{!! trans('cachet.system.update') !!}</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="section-components no-select">
@if(!$component_groups->isEmpty() || !$ungrouped_components->isEmpty())
@include('dashboard.partials.components')
@else
<ul class="list-group components">
<li class="list-group-item">
<a href="{{ cachet_route('dashboard.components.create') }}">{{ trans('dashboard.components.add.message') }}</a>
</li>
</ul>
@endif
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 col-lg-6">
<div class="stats-widget">
<div class="stats-top">
<span class="stats-value"><a href="{{ cachet_route('dashboard.incidents') }}">{{ $incidents->reduce(function($carry, $incident) { return $carry + count($incident); }) }}</a></span>
<span class="stats-label">{{ trans('dashboard.incidents.incidents') }}</span>
</div>
<div class="stats-chart">
<div class="sparkline" data-type="line" data-resize="true" data-height="80" data-width="100%" data-line-width="2" data-min-spot-color="#e65100" data-max-spot-color="#ffb300" data-line-color="#3498db" data-spot-color="#00838f" data-fill-color="#3498db" data-highlight-line-color="#00acc1" data-highlight-spot-color="#ff8a65" data-spot-radius="false" data-data="[{{ $incidents->map(function ($incident) { return count($incident); } )->implode(',') }}]"></div>
</div>
</div>
</div>
<div class="col-sm-12 col-lg-6">
<div class="stats-widget">
<div class="stats-top">
<span class="stats-value"><a href="{{ cachet_route('dashboard.subscribers') }}">{{ $subscribers->reduce(function($carry, $subscribers) { return $carry + count($subscribers); }) }}</a></span>
<span class="stats-label">{{ trans('dashboard.subscribers.subscribers') }}</span>
</div>
<div class="stats-chart">
<div class="sparkline" data-type="line" data-resize="true" data-height="80" data-width="100%" data-line-width="2" data-min-spot-color="#e65100" data-max-spot-color="#ffb300" data-line-color="#3498db" data-spot-color="#00838f" data-fill-color="#3498db" data-highlight-line-color="#00acc1" data-highlight-spot-color="#ff8a65" data-spot-radius="false" data-data="[{{ $subscribers->map(function ($subscriber) { return count($subscriber); } )->implode(',') }}]"></div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 col-lg-6">
<div class="stats-widget">
<div class="stats-top">
<span class="stats-value">{{ trans('dashboard.widgets.support') }}</span>
<span class="stats-label">{!! trans('dashboard.widgets.support_subtitle') !!}</span>
</div>
</div>
</div>
@if($entries)
<div class="col-sm-12 col-lg-6">
<div class="stats-widget">
<div class='stats-top'>
<span class='stats-value'>{{ trans('dashboard.widgets.news') }}</span>
<span class='stats-label'>{{ trans('dashboard.widgets.news_subtitle') }}</span>
</div>
<div class='stats-body'>
<div class="list-group">
@foreach($entries as $entry)
<a class="list-group-item" href="{{ $entry->link }}" target="_blank">{{ $entry->title }}, <small>{{ $entry->pubDate }}</small> <span class="badge"><i class="ion-android-open"></i></span></a>
@endforeach
</div>
</div>
</div>
</div>
@endif
</div>
</div>
@includeWhen($welcome_user, 'dashboard.partials.welcome-modal')
</div>
@stop

View File

@ -42,22 +42,26 @@
<body class="dashboard">
<div class="wrapper" id="app">
@include('dashboard.partials.sidebar')
<div class="page-content">
@if(!$is_writeable)
<div class="content-wrapper">
<div class="row">
<div class="col-sm-12">
<div class="alert alert-info">
{!! trans('dashboard.writeable_settings') !!}
<dashboard inline-template :user="{{ $current_user }}">
<div>
@include('dashboard.partials.sidebar')
<div class="page-content">
@if(!$is_writeable)
<div class="content-wrapper">
<div class="row">
<div class="col-sm-12">
<div class="alert alert-info">
{!! trans('dashboard.writeable_settings') !!}
</div>
</div>
</div>
</div>
@endif
@yield('content')
</div>
</div>
@endif
@yield('content')
</div>
</dashboard>
</div>
</body>
@yield('js')