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
This commit is contained in:
ro 2024-02-21 16:47:05 -06:00
parent 2a6b4b2c99
commit a109b1b5c1
9 changed files with 87 additions and 34 deletions

View file

@ -29,7 +29,8 @@ class DenController extends Controller
$member = Auth::user(); $member = Auth::user();
return view('back.start', [ return view('back.start', [
'handle' => $member->handle, '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"]); '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(); $member = Auth::user();
$page = $this->pagination->getPage($pageNum); $page = $this->pagination->getPage($pageNum);

View file

@ -3,6 +3,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Repositories\LocationRepository; use App\Repositories\LocationRepository;
use App\Repositories\SourceRepository; use App\Repositories\SourceRepository;
use App\Services\PaginationService; use App\Services\PaginationService;
@ -68,9 +69,16 @@ class FrontIndexController extends Controller
$location = $this->location->getLocation($uuid); $location = $this->location->getLocation($uuid);
$sources = $this->source->getActive(); $sources = $this->source->getActive();
$name = "NO LOCATION FOUND"; $name = "NO LOCATION FOUND";
$member = Auth::user();
$edit = false;
if ($location) { if ($location) {
$name = $location->name; $name = $location->name;
} }
if (isset($member->role)) {
($member->role == 1 || $member->role == 2) ? $edit = true : $edit = false;
}
return view('front.location', [ return view('front.location', [
'title' => str_replace(".", " ", $name), 'title' => str_replace(".", " ", $name),
'location' => $location, 'location' => $location,
@ -78,6 +86,7 @@ class FrontIndexController extends Controller
'sources_count' => count($sources), 'sources_count' => count($sources),
'images' => json_decode($location->images), 'images' => json_decode($location->images),
'updated' => $location->updated_at->format('Y M d'), 'updated' => $location->updated_at->format('Y M d'),
'edit' => $edit
]); ]);
} }

View file

@ -9,6 +9,7 @@ input[type="text"] {
background: var(--white); background: var(--white);
color: var(--primary); color: var(--primary);
transition: all 0.2s linear; transition: all 0.2s linear;
height: 30px;
} }
input[type="text"]:focus, input[type="text"]:focus,
@ -34,6 +35,7 @@ input[type="submit"] {
cursor: pointer; cursor: pointer;
border: 0; border: 0;
transition: all 0.3s linear; transition: all 0.3s linear;
height: 35px;
} }
select { select {

View file

@ -2,7 +2,7 @@ html {
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
font: 400 1.6em/1.3em var(--base-type); font: 400 1.4em/1.4em var(--base-type);
} }
html body { html body {
@ -20,6 +20,7 @@ a {
color: var(--highlight); color: var(--highlight);
text-decoration: none; text-decoration: none;
transition: all 0.2s linear; transition: all 0.2s linear;
/* /*
border-bottom: 1px solid var(--white); border-bottom: 1px solid var(--white);
@ -30,6 +31,11 @@ strong {
color: var(--secondary); color: var(--secondary);
} }
hr {
border-width: 0.5px;
border-color: var(--white);
}
header { header {
width: 100%; width: 100%;
color: var(--primary); color: var(--primary);

View file

@ -0,0 +1,37 @@
@extends('frame')
@section('title', 'Den | Location Admin')
@section('main-content')
@parent
<section>
<article>
<h2>Page {{$pageNum}}</h2>
<a href="/listings/{{$prev}}">PREV</a>
{{$pageNum}} of {{$totalPages}}
<a href="/listings/{{$next}}">NEXT</a><br /><br />
@foreach($locations as $location)
@php
$action = $location->block_count + $location->silence_count;
$rating = ($action / $sources)*100;
@endphp
<a class="list-link" role="listitem" href="/den/location/edit/{{$location->uuid}}">
<span class="item-rating">{{$rating}}%</span>
<label class="item-name">{{$location->name}}</label>
<div class="item-silence">
<img class="item-icon" src="/assets/images/global/status-silence.svg" title="silenced" />
{{$location->silence_count}}
</div>
<div class="item-block">
<img class="item-icon" src="/assets/images/global/status-suspend.svg" title="suspended" />
{{$location->block_count}}
</div>
</a>
@endforeach
<br />
<a href="/listings/{{$prev}}">PREV</a>
{{$pageNum}} of {{$totalPages}}
<a href="/listings/{{$next}}">NEXT</a>
</article>
</section>
@endsection

View file

@ -6,32 +6,11 @@
@parent @parent
<section> <section>
<article> <article>
<h2>Page {{$pageNum}}</h2> <h2>Manage Locations</h2>
<a href="/listings/{{$prev}}">PREV</a> <h3>Update Location Data</h3>
{{$pageNum}} of {{$totalPages}} <a href="/den/admin/update">Update Current Sources Data</a><br />
<a href="/listings/{{$next}}">NEXT</a><br /><br /> <a href="/den/admin/compile">Update Locations Data</a>
@foreach($locations as $location) <h3>View Location Listings</h3>
@php
$action = $location->block_count + $location->silence_count;
$rating = ($action / $sources)*100;
@endphp
<a class="list-link" role="listitem" href="/den/location/edit/{{$location->uuid}}">
<span class="item-rating">{{$rating}}%</span>
<label class="item-name">{{$location->name}}</label>
<div class="item-silence">
<img class="item-icon" src="/assets/images/global/status-silence.svg" title="silenced" />
{{$location->silence_count}}
</div>
<div class="item-block">
<img class="item-icon" src="/assets/images/global/status-suspend.svg" title="suspended" />
{{$location->block_count}}
</div>
</a>
@endforeach
<br />
<a href="/listings/{{$prev}}">PREV</a>
{{$pageNum}} of {{$totalPages}}
<a href="/listings/{{$next}}">NEXT</a>
</article> </article>
</section> </section>
@endsection @endsection

View file

@ -1,14 +1,17 @@
@extends('frame') @extends('frame')
@section('title', 'Den|Start') @section('title', 'Den | Start')
@section('main-content') @section('main-content')
<section> <section>
<article> <article>
<h2>Hey {{$handle}} </h2> <h2>Hey {{$handle}} </h2>
<a href="/den/member">Manage Member</a><br /> <a href="/den/you">Edit Your Account</a><br />
<a href="/den/locations/1">Manage Location</a> <a href="/den/locations">Manage Locations</a><br />
@if($role==1)
<a href="/den/member">Manage Members</a><br />
@endif
</article> </article>
</section> </section>
@endsection @endsection

View file

@ -37,6 +37,13 @@
</div> </div>
@if($edit)
<hr />
<a href="/den/location/edit/{{$location->uuid}}">Edit {{$location->name}}</a>
<hr />
@endif
<br /> <br />
Heat Rating is the percentage of <a href="/about#how">Current Sources</a> 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. Heat Rating is the percentage of <a href="/about#how">Current Sources</a> 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.

View file

@ -41,10 +41,11 @@ Route::get("/logout", [AuthController::class, 'leave']);
Route::group(['prefix' => 'den', 'middleware' => 'member.check'], function () { Route::group(['prefix' => 'den', 'middleware' => 'member.check'], function () {
Route::get("/", [DenController::class, 'start']); Route::get("/", [DenController::class, 'start']);
Route::get("/member", [DenController::class, 'member']); 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::get("/location/edit/{uuid}", [DenController::class, 'locationEdit']);
Route::post("/locations/edit", [LocationController::class, 'editLocation']); Route::get("/locations", [DenController::class, 'locations']);
//admin actions //admin actions
Route::post("/locations/edit", [LocationController::class, 'editLocation']);
Route::get("/admin/update", [LocationController::class, 'updateLocations']); Route::get("/admin/update", [LocationController::class, 'updateLocations']);
Route::get("/admin/compile", [LocationController::class, 'compileLocations']); Route::get("/admin/compile", [LocationController::class, 'compileLocations']);
}); });