Add basic admin dashboard views

This commit is contained in:
Daniel Supernault 2018-05-20 15:50:11 -06:00
parent 31a238e925
commit b144efbe96
6 changed files with 232 additions and 0 deletions

View file

@ -0,0 +1,24 @@
@extends('admin.partial.template')
@section('section')
<div class="title">
<h3 class="font-weight-bold">Media</h3>
</div>
<hr>
<div class="profile-timeline mt-5 row">
@foreach($media as $status)
<div class="col-12 col-md-4 mb-4">
<a class="card" href="{{$status->url()}}">
<img class="card-img-top" src="{{$status->thumb()}}" width="150px" height="150px">
</a>
</div>
@endforeach
</div>
<hr>
<div class="d-flex justify-content-center">
{{$media->links()}}
</div>
@endsection

View file

@ -0,0 +1,37 @@
<div class="col-12 col-md-3 py-3" style="border-right:1px solid #ccc;">
<ul class="nav flex-column settings-nav">
<li class="nav-item pl-3 {{request()->is('dashboard')?'active':''}}">
<a class="nav-link lead text-muted" href="{{route('admin.home')}}">Dashboard</a>
</li>
<li class="nav-item pl-3 {{request()->is('alerts*')?'active':''}}">
<a class="nav-link lead text-muted" href="#">Alerts</a>
</li>
<li class="nav-item">
<hr>
</li>
<li class="nav-item pl-3 {{request()->is('instances*')?'active':''}}">
<a class="nav-link lead text-muted" href="#">Instances</a>
</li>
<li class="nav-item pl-3 {{request()->is('media*')?'active':''}}">
<a class="nav-link lead text-muted" href="{{route('admin.media')}}">Media</a>
</li>
<li class="nav-item pl-3 {{request()->is('reports*')?'active':''}}">
<a class="nav-link lead text-muted" href="#">Reports</a>
</li>
<li class="nav-item pl-3 {{request()->is('statuses*')?'active':''}}">
<a class="nav-link lead text-muted" href="{{route('admin.statuses')}}">Statuses</a>
</li>
<li class="nav-item pl-3 {{request()->is('users*')?'active':''}}">
<a class="nav-link lead text-muted" href="{{route('admin.users')}}">Users</a>
</li>
<li class="nav-item">
<hr>
</li>
<li class="nav-item pl-3">
<a class="nav-link lead text-muted" href="/horizon">Redis Queue</a>
</li>
<li class="nav-item pl-3 {{request()->is('settings*')?'active':''}}">
<a class="nav-link lead text-muted" href="#">Settings</a>
</li>
</ul>
</div>

View file

@ -0,0 +1,25 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="col-12 mt-5">
<div class="card">
<div class="card-body p-0">
<div class="row">
@include('admin.partial.sidebar')
<div class="col-12 col-md-9 p-5">
@if (session('status'))
<div class="alert alert-success">
{{ session('status')}}
</div>
@endif
@yield('section')
</div>
</div>
</div>
</div>
</div>
</div>
@endsection

View file

@ -0,0 +1,55 @@
@extends('admin.partial.template')
@section('section')
<div class="title">
<h3 class="font-weight-bold">Statuses</h3>
</div>
<hr>
<table class="table">
<thead class="thead-dark">
<tr>
<th scope="col">#</th>
<th scope="col">Username</th>
<th scope="col">Caption</th>
<th scope="col">Storage</th>
<th scope="col">Created</th>
</tr>
</thead>
<tbody>
@foreach($statuses as $status)
<tr>
<th scope="row">
<a href="/statuses/show/{{$status->id}}">
{{$status->id}}
</a>
</th>
<td>{{$status->profile->username}}</td>
<td>{{str_limit($status->caption, 30)}}</td>
@if(!$status->media_path)
<td>0</td>
@else
<td><div class="human-size" data-bytes="{{$status->firstMedia()->size}}">{{$status->firstMedia()->size}}</div></td>
@endif
<td>{{$status->created_at->diffForHumans()}}</td>
</tr>
@endforeach
</tbody>
</table>
<div class="d-flex justify-content-center mt-5">
{{$statuses->links()}}
</div>
@endsection
@push('scripts')
<script type="text/javascript">
$(document).ready(function() {
$('.human-size').each(function(d,a) {
let el = $(a);
let size = el.data('bytes');
el.text(filesize(size, {round: 0}));
});
});
</script>
@endpush

View file

@ -0,0 +1,36 @@
@extends('admin.partial.template')
@section('section')
<div class="title">
<h3 class="font-weight-bold">Status #{{$status->id}}</h3>
</div>
<hr>
<div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-outline-secondary">View Details</button>
<button type="button" class="btn btn-outline-secondary">View User Stats</button>
<button type="button" class="btn btn-outline-danger">Delete</button>
</div>
</div>
@php($item = $status)
@include('status.template')
@endsection
@push('scripts')
<script type="text/javascript">
$(document).ready(function() {
$('.human-size').each(function(d,a) {
let el = $(a);
let size = el.data('bytes');
el.text(filesize(size, {round: 0}));
});
$('.status-card .card-footer').hide();
$('.status-card .reactions').hide();
$('.status-card .comments').hide();
});
</script>
@endpush

View file

@ -0,0 +1,55 @@
@extends('admin.partial.template')
@section('section')
<div class="title">
<h3 class="font-weight-bold">Users</h3>
</div>
<hr>
<table class="table">
<thead class="thead-dark">
<tr>
<th scope="col">#</th>
<th scope="col">Username</th>
<th scope="col">Email</th>
<th scope="col">Statuses</th>
<th scope="col">Storage</th>
<th scope="col">Role</th>
<th scope="col">Created</th>
</tr>
</thead>
<tbody>
@foreach($users as $user)
<tr>
<th scope="row">
<a href="/users/show/{{$user->id}}">
{{$user->id}}
</a>
</th>
<td>{{$user->username}}</td>
<td>{{$user->email}}</td>
<td>{{$user->profile->statuses->count()}}</td>
<td><p class="human-size" data-bytes="{{App\Media::whereUserId($user->id)->sum('size')}}"></p></td>
<td>{!!$user->is_admin ? '<span class="text-danger">admin</span>' : 'member'!!}</td>
<td>{{$user->created_at->diffForHumans(null, true, true)}}</td>
</tr>
@endforeach
</tbody>
</table>
<div class="d-flex justify-content-center mt-5">
{{$users->links()}}
</div>
@endsection
@push('scripts')
<script type="text/javascript">
$(document).ready(function() {
$('.human-size').each(function(d,a) {
let el = $(a);
let size = el.data('bytes');
el.text(filesize(size, {round: 0}));
});
});
</script>
@endpush