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();
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);

View file

@ -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
]);
}

View file

@ -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 {

View file

@ -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);

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
<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>
<h2>Manage Locations</h2>
<h3>Update Location Data</h3>
<a href="/den/admin/update">Update Current Sources Data</a><br />
<a href="/den/admin/compile">Update Locations Data</a>
<h3>View Location Listings</h3>
</article>
</section>
@endsection

View file

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

View file

@ -37,6 +37,13 @@
</div>
@if($edit)
<hr />
<a href="/den/location/edit/{{$location->uuid}}">Edit {{$location->name}}</a>
<hr />
@endif
<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.

View file

@ -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']);
});