From 7c16dc53b55aa50d6c9ac0bdea2f51fbbf2b20b0 Mon Sep 17 00:00:00 2001 From: Frankie B Date: Sun, 16 Jul 2023 21:02:51 +0100 Subject: feat: site admin (#8) --- resources/views/errors/generic-error.blade.php | 9 ++++++ resources/views/errors/no-auth.blade.php | 8 ++++++ resources/views/includes/admin/header.blade.php | 12 ++++++++ resources/views/includes/header.blade.php | 8 +++++- resources/views/layouts/default-admin.blade.php | 23 +++++++++++++++ .../pages/admin/guestbook-del-confirm.blade.php | 33 ++++++++++++++++++++++ resources/views/pages/admin/guestbook.blade.php | 27 ++++++++++++++++++ resources/views/pages/admin/index.blade.php | 9 ++++++ 8 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 resources/views/errors/generic-error.blade.php create mode 100644 resources/views/errors/no-auth.blade.php create mode 100644 resources/views/includes/admin/header.blade.php create mode 100644 resources/views/layouts/default-admin.blade.php create mode 100644 resources/views/pages/admin/guestbook-del-confirm.blade.php create mode 100644 resources/views/pages/admin/guestbook.blade.php create mode 100644 resources/views/pages/admin/index.blade.php (limited to 'resources') diff --git a/resources/views/errors/generic-error.blade.php b/resources/views/errors/generic-error.blade.php new file mode 100644 index 0000000..9764a02 --- /dev/null +++ b/resources/views/errors/generic-error.blade.php @@ -0,0 +1,9 @@ +@extends('layouts.minimal') +@section('title', 'Error 401: Unauthorized User!') +@section('content') +

{{ $error }}

+
+ @if(isset($description)) +

{{ $description }}

+ @endif +@stop diff --git a/resources/views/errors/no-auth.blade.php b/resources/views/errors/no-auth.blade.php new file mode 100644 index 0000000..8682010 --- /dev/null +++ b/resources/views/errors/no-auth.blade.php @@ -0,0 +1,8 @@ +@extends('layouts.minimal') +@section('title', 'Error 401: Unauthorized User!') +@section('content') +

Error 401: Unauthorized User!

+
+

Woah there! Only authorized users can access this page. Please log in to proceed.

+

Ended up here on accident? Click here to return to the homepage!

+@stop diff --git a/resources/views/includes/admin/header.blade.php b/resources/views/includes/admin/header.blade.php new file mode 100644 index 0000000..edb2fd7 --- /dev/null +++ b/resources/views/includes/admin/header.blade.php @@ -0,0 +1,12 @@ + diff --git a/resources/views/includes/header.blade.php b/resources/views/includes/header.blade.php index 53d44e2..01de256 100644 --- a/resources/views/includes/header.blade.php +++ b/resources/views/includes/header.blade.php @@ -1,12 +1,18 @@ diff --git a/resources/views/layouts/default-admin.blade.php b/resources/views/layouts/default-admin.blade.php new file mode 100644 index 0000000..5a16524 --- /dev/null +++ b/resources/views/layouts/default-admin.blade.php @@ -0,0 +1,23 @@ + + + + @include('includes.head') + + + +
+
+ @include('includes.admin.header') +
+ +
+
+@yield('content') +
+ +
+
+ + diff --git a/resources/views/pages/admin/guestbook-del-confirm.blade.php b/resources/views/pages/admin/guestbook-del-confirm.blade.php new file mode 100644 index 0000000..99d2a4c --- /dev/null +++ b/resources/views/pages/admin/guestbook-del-confirm.blade.php @@ -0,0 +1,33 @@ +@extends('layouts.minimal') +@section('title', 'Delete confirm') +@section('content') +

Delete Confirmation

+
+

Are you sure you want to delete this entry?

+ +

Entry Details:

+ + + + + + + + + + + + + + + + + +
ID:{{ $entry->id }}
Name:{{ $entry->name }}
Date:{{ gmdate("H:i:s - Y-m-d", $entry->timestamp) }}
Message:{{ $entry->message }}
+ +
+ @csrf + + +
+@stop diff --git a/resources/views/pages/admin/guestbook.blade.php b/resources/views/pages/admin/guestbook.blade.php new file mode 100644 index 0000000..56323ef --- /dev/null +++ b/resources/views/pages/admin/guestbook.blade.php @@ -0,0 +1,27 @@ +@extends('layouts.default-admin') +@section('title', 'guestbook') +@section('content') + @php + $entries = DB::select('SELECT id, name, timestamp, message FROM guestbook_entries ORDER BY id DESC'); + @endphp +

Entries ({{ count($entries) }} total)

+ @foreach ($entries as $entry) + + + + + + + +
+ Name: {{ $entry->name }}
+ Date: {{ gmdate("H:i:s - Y-m-d", $entry->timestamp) }} +
+ del +
+
+ {{ htmlspecialchars($entry->message) }} +
+ @endforeach +@stop + diff --git a/resources/views/pages/admin/index.blade.php b/resources/views/pages/admin/index.blade.php new file mode 100644 index 0000000..fd34313 --- /dev/null +++ b/resources/views/pages/admin/index.blade.php @@ -0,0 +1,9 @@ +@extends('layouts.default-admin') +@section('title', 'Page Title') +@section('description', 'Page description goes here') +@php + $user = auth()->user(); +@endphp +@section('content') +

You are logged in as {{ $user->name }} ({{ $user->email }})

+@stop -- cgit v1.2.3-54-g00ecf