Tweak admin alert on blog post delete

This commit is contained in:
Alex Thomassen 2020-03-10 14:57:35 +01:00
parent 7a4d7aa7ca
commit 60b4cdd8e9
Signed by: Alex
GPG Key ID: 10BD786B5F6FF5DE
2 changed files with 30 additions and 7 deletions

View File

@ -14,8 +14,8 @@
@markdown($post->body) @markdown($post->body)
</div> </div>
<div class="row"> <div class="row align-items-center">
<span class="col align-self-center text-muted"> <span class="col-6 text-muted">
Created: {{ $post->created_at }} Created: {{ $post->created_at }}
@if ($post->created_at->diffInSeconds($post->updated_at) > 1) @if ($post->created_at->diffInSeconds($post->updated_at) > 1)
| Last updated: {{ $post->updated_at }} | Last updated: {{ $post->updated_at }}
@ -23,7 +23,7 @@
</span> </span>
@can('delete', $post) @can('delete', $post)
<span class="col align-self-center text-right"> <span class="col-6 text-right">
<form action="{{ route('posts.delete', $post->id) }}" method="post"> <form action="{{ route('posts.delete', $post->id) }}" method="post">
@method('delete') @method('delete')
@csrf @csrf
@ -36,9 +36,13 @@
@auth @auth
@if (Auth::admin() && Auth::id() !== $user->id) @if (Auth::admin() && Auth::id() !== $user->id)
<!-- TODO: Fix design --> <div class="row">
<div class="col alert alert-danger"> <span class="col align-self-end">
<i class="fas fa-exclamation-triangle fa-fw"></i> Be careful! You have permissions to delete all blog posts, so keep that in mind before clicking on buttons. <div class="alert alert-danger">
<i class="fas fa-exclamation-triangle fa-fw"></i>
Warning! This blog post belongs to <strong>{{ $user->name }}</strong>.
</div>
</span>
</div> </div>
@endif @endif
@endauth @endauth

View File

@ -4,7 +4,26 @@
<div class="container"> <div class="container">
<div class="text-center"> <div class="text-center">
<h1>Welcome to the {{ env('APP_NAME', 'Hovedprosjekt') }} homepage!</h1> <h1>Welcome to the {{ env('APP_NAME', 'Hovedprosjekt') }} homepage!</h1>
<img src="/media/finsrud.png" alt="GASP"> <img src="/media/finsrud.png" title="Øyvind Finsrud - Circa 2010">
</div>
<br>
<br>
<h2 class="text-center">Check out our users and their blog posts!</h2>
<div class="list-group">
@foreach (App\User::all() as $user)
@if ($user->posts->isEmpty())
@continue
@endif
<div class="list-group-item">
<i class="fas fa-user fa-fw"></i>
<a href="{{ route('posts.index', $user->username) }}">
{{ $user->name }} ({{$user->username}})
</a>
</div>
@endforeach
</div> </div>
</div> </div>
@endsection @endsection