diff --git a/app/Http/Controllers/Admin/AdminCommentsController.php b/app/Http/Controllers/Admin/AdminCommentsController.php index 9a2552d56..f1e4d242c 100644 --- a/app/Http/Controllers/Admin/AdminCommentsController.php +++ b/app/Http/Controllers/Admin/AdminCommentsController.php @@ -4,35 +4,34 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\BasePageController; use App\Models\ReleaseComment; +use Illuminate\Http\RedirectResponse; +use Illuminate\View\View; class AdminCommentsController extends BasePageController { /** - * @throws \Exception + * Display a listing of comments */ - public function index(): void + public function index(): View { $this->setAdminPrefs(); $meta_title = $title = 'Comments List'; $commentsList = ReleaseComment::getCommentsRange(); - $this->smarty->assign('commentslist', $commentsList); - $content = $this->smarty->fetch('comments-list.tpl'); - $this->smarty->assign(compact('title', 'meta_title', 'content')); - $this->adminrender(); + return view('admin.comments.index', compact('commentsList', 'title', 'meta_title')); } /** - * @return \Illuminate\Http\RedirectResponse + * Delete a comment */ - public function destroy(int $id) + public function destroy(int $id): RedirectResponse { if ($id) { ReleaseComment::deleteComment($id); } - return redirect()->back(); + return redirect()->back()->with('success', 'Comment deleted successfully'); } } diff --git a/resources/views/admin/comments/index.blade.php b/resources/views/admin/comments/index.blade.php new file mode 100644 index 000000000..8e4837a54 --- /dev/null +++ b/resources/views/admin/comments/index.blade.php @@ -0,0 +1,138 @@ +@extends('layouts.admin') + +@section('content') +
+
+ +
+
+

+ {{ $title }} +

+
+ Total: {{ $commentsList->total() }} comments +
+
+
+ + +
+ + + + + + + + + + + + + + @forelse($commentsList as $comment) + + + + + + + + + + @empty + + + + @endforelse + +
IDUserCommentReleaseStatusCreatedActions
+ #{{ $comment->id }} + +
+
+
+ {{ $comment->username }} +
+ @if($comment->host) +
+ {{ $comment->host }} +
+ @endif +
+
+
+
+
+ {{ Str::limit($comment->text, 150) }} +
+
+
+ @if($comment->guid) + + View Release + + @else + + @endif + +
+ @if($comment->isvisible) + + Visible + + @else + + Hidden + + @endif + @if($comment->shared) + + Shared + + @endif + @if($comment->issynced) + + Synced + + @endif +
+
+
{{ $comment->created_at ? $comment->created_at->format('Y-m-d') : '—' }}
+
{{ $comment->created_at ? $comment->created_at->format('H:i:s') : '' }}
+
+
+ @csrf + +
+
+ No comments found. +
+
+ + +
+ {{ $commentsList->links() }} +
+
+
+ +@push('styles') + +@endpush +@endsection + diff --git a/resources/views/partials/admin-menu.blade.php b/resources/views/partials/admin-menu.blade.php index b4443efe2..0d6691343 100644 --- a/resources/views/partials/admin-menu.blade.php +++ b/resources/views/partials/admin-menu.blade.php @@ -42,6 +42,12 @@ + + + + Comments + +