From a109b1b5c1fb43e1db15912a040f2d91ebf9e948 Mon Sep 17 00:00:00 2001 From: ro Date: Wed, 21 Feb 2024 16:47:05 -0600 Subject: [PATCH] Den reorganizing, edit location link, form styles The admin area needed to be reorganized as it was a bit all over the place to accomodate new features. And edit link was added to location detail pages so authorized members can edit when necessary. Form elements were loosened up a bit to give them a bit more breathing room --- app/Http/Controllers/DenController.php | 13 ++++++- app/Http/Controllers/FrontIndexController.php | 9 +++++ public/assets/css/global/forms.css | 2 + public/assets/css/global/frame.css | 8 +++- resources/views/back/listings.php | 37 +++++++++++++++++++ resources/views/back/locations.blade.php | 31 +++------------- resources/views/back/start.blade.php | 9 +++-- resources/views/front/location.blade.php | 7 ++++ routes/web.php | 5 ++- 9 files changed, 87 insertions(+), 34 deletions(-) create mode 100644 resources/views/back/listings.php diff --git a/app/Http/Controllers/DenController.php b/app/Http/Controllers/DenController.php index a1d5aa9..9f2d8fd 100644 --- a/app/Http/Controllers/DenController.php +++ b/app/Http/Controllers/DenController.php @@ -29,7 +29,8 @@ class DenController extends Controller $member = Auth::user(); return view('back.start', [ 'handle' => $member->handle, - 'title' => "This is The Den" + 'title' => "This is The Den", + 'role' => $member->role ]); } @@ -41,7 +42,15 @@ class DenController extends Controller 'title' => "Manage Members"]); } - public function location(Request $request, $pageNum = 1) + public function locations(Request $request) + { + $member = Auth::user(); + return view('back.locations', [ + 'handle' => $member->handle, + 'title' => "Manage Locations"]); + } + + public function listings(Request $request, $pageNum = 1) { $member = Auth::user(); $page = $this->pagination->getPage($pageNum); diff --git a/app/Http/Controllers/FrontIndexController.php b/app/Http/Controllers/FrontIndexController.php index 55cb514..e6e1e83 100644 --- a/app/Http/Controllers/FrontIndexController.php +++ b/app/Http/Controllers/FrontIndexController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; use App\Repositories\LocationRepository; use App\Repositories\SourceRepository; use App\Services\PaginationService; @@ -68,9 +69,16 @@ class FrontIndexController extends Controller $location = $this->location->getLocation($uuid); $sources = $this->source->getActive(); $name = "NO LOCATION FOUND"; + $member = Auth::user(); + $edit = false; if ($location) { $name = $location->name; } + + if (isset($member->role)) { + ($member->role == 1 || $member->role == 2) ? $edit = true : $edit = false; + } + return view('front.location', [ 'title' => str_replace(".", " ", $name), 'location' => $location, @@ -78,6 +86,7 @@ class FrontIndexController extends Controller 'sources_count' => count($sources), 'images' => json_decode($location->images), 'updated' => $location->updated_at->format('Y M d'), + 'edit' => $edit ]); } diff --git a/public/assets/css/global/forms.css b/public/assets/css/global/forms.css index 0053aa9..32d16a0 100644 --- a/public/assets/css/global/forms.css +++ b/public/assets/css/global/forms.css @@ -9,6 +9,7 @@ input[type="text"] { background: var(--white); color: var(--primary); transition: all 0.2s linear; + height: 30px; } input[type="text"]:focus, @@ -34,6 +35,7 @@ input[type="submit"] { cursor: pointer; border: 0; transition: all 0.3s linear; + height: 35px; } select { diff --git a/public/assets/css/global/frame.css b/public/assets/css/global/frame.css index a20eb92..e14b28c 100644 --- a/public/assets/css/global/frame.css +++ b/public/assets/css/global/frame.css @@ -2,7 +2,7 @@ html { width: 100%; height: 100%; overflow: hidden; - font: 400 1.6em/1.3em var(--base-type); + font: 400 1.4em/1.4em var(--base-type); } html body { @@ -20,6 +20,7 @@ a { color: var(--highlight); text-decoration: none; transition: all 0.2s linear; + /* border-bottom: 1px solid var(--white); @@ -30,6 +31,11 @@ strong { color: var(--secondary); } +hr { + border-width: 0.5px; + border-color: var(--white); +} + header { width: 100%; color: var(--primary); diff --git a/resources/views/back/listings.php b/resources/views/back/listings.php new file mode 100644 index 0000000..3402815 --- /dev/null +++ b/resources/views/back/listings.php @@ -0,0 +1,37 @@ +@extends('frame') + +@section('title', 'Den | Location Admin') + + @section('main-content') + @parent +
+ +
+ @endsection \ No newline at end of file diff --git a/resources/views/back/locations.blade.php b/resources/views/back/locations.blade.php index 3402815..20c2b41 100644 --- a/resources/views/back/locations.blade.php +++ b/resources/views/back/locations.blade.php @@ -6,32 +6,11 @@ @parent
-

Page {{$pageNum}}

- PREV - {{$pageNum}} of {{$totalPages}} - NEXT

- @foreach($locations as $location) - @php - $action = $location->block_count + $location->silence_count; - $rating = ($action / $sources)*100; - @endphp - - {{$rating}}% - -
- - {{$location->silence_count}} -
-
- - {{$location->block_count}} -
-
- @endforeach -
- PREV - {{$pageNum}} of {{$totalPages}} - NEXT +

Manage Locations

+

Update Location Data

+ Update Current Sources Data
+ Update Locations Data +

View Location Listings

@endsection \ No newline at end of file diff --git a/resources/views/back/start.blade.php b/resources/views/back/start.blade.php index 4f09322..0d8bc13 100644 --- a/resources/views/back/start.blade.php +++ b/resources/views/back/start.blade.php @@ -1,14 +1,17 @@ @extends('frame') -@section('title', 'Den|Start') +@section('title', 'Den | Start') @section('main-content')
@endsection \ No newline at end of file diff --git a/resources/views/front/location.blade.php b/resources/views/front/location.blade.php index 6c8a785..2c1d947 100644 --- a/resources/views/front/location.blade.php +++ b/resources/views/front/location.blade.php @@ -37,6 +37,13 @@ + @if($edit) +
+ Edit {{$location->name}} +
+ @endif + +
Heat Rating is the percentage of Current Sources that have taken action against an instance. The higher the number of Sources that have silenced and/or suspended an instance, the higher the Heat Rating. diff --git a/routes/web.php b/routes/web.php index b7ac2de..407e2ae 100644 --- a/routes/web.php +++ b/routes/web.php @@ -41,10 +41,11 @@ Route::get("/logout", [AuthController::class, 'leave']); Route::group(['prefix' => 'den', 'middleware' => 'member.check'], function () { Route::get("/", [DenController::class, 'start']); Route::get("/member", [DenController::class, 'member']); - Route::get("/locations/{pageNum}", [DenController::class, 'location']); + Route::get("/listings/{pageNum}", [DenController::class, 'location']); Route::get("/location/edit/{uuid}", [DenController::class, 'locationEdit']); - Route::post("/locations/edit", [LocationController::class, 'editLocation']); + Route::get("/locations", [DenController::class, 'locations']); //admin actions + Route::post("/locations/edit", [LocationController::class, 'editLocation']); Route::get("/admin/update", [LocationController::class, 'updateLocations']); Route::get("/admin/compile", [LocationController::class, 'compileLocations']); });