updated image uploading, edited html templates

changed the the way files are uploaded to go into their own directory
called 'references' organized by location, identified by uuid. the
'references' directory was added to git ignore to those images are not
saved in the repo, since every install will have their own set of images

also updated reference links to be shown on the front end if they have
been added to a location

unnecessary links where moved from the admin member template since they
have been incorporated into the appropriate area.

a template for editing member account information has also been added.
This commit is contained in:
ro 2024-09-13 15:12:43 -06:00
parent 43e0004ac5
commit 0eeab6355e
10 changed files with 50 additions and 18 deletions

1
.gitignore vendored
View file

@ -4,6 +4,7 @@
/public/hot /public/hot
/public/storage /public/storage
/public/reference /public/reference
/public/assets/images/references
/storage/*.key /storage/*.key
/vendor /vendor
.env .env

View file

@ -34,6 +34,16 @@ class DenController extends Controller
]); ]);
} }
public function profile(Request $request)
{
$member = Auth::user();
return view('back.profile', [
'handle' => $member->handle,
'title' => "Your Profile",
'role' => $member->role
]);
}
public function member(Request $request) public function member(Request $request)
{ {
$member = Auth::user(); $member = Auth::user();

View file

@ -79,12 +79,14 @@ class FrontIndexController extends Controller
($member->role == 1 || $member->role == 2) ? $edit = true : $edit = false; ($member->role == 1 || $member->role == 2) ? $edit = true : $edit = false;
} }
$links = explode(',', $location->archive_links);
return view('front.location', [ return view('front.location', [
'title' => str_replace(".", " ", $name), 'title' => str_replace(".", " ", $name),
'location' => $location, 'location' => $location,
'actions' => $location->block_count + $location->silence_count, 'actions' => $location->block_count + $location->silence_count,
'sources_count' => count($sources), 'sources_count' => count($sources),
'images' => json_decode($location->images), 'images' => json_decode($location->images),
'links' => $links,
'updated' => $location->updated_at->format('Y M d'), 'updated' => $location->updated_at->format('Y M d'),
'edit' => $edit 'edit' => $edit
]); ]);

View file

@ -56,24 +56,34 @@ class LocationRepository
public function editLocation($request) public function editLocation($request)
{ {
$location = $this->getLocation($request->id); $location = $this->getLocation($request->id);
$images = []; $publicPath = '../public/';
$refPath = 'assets/images/references/' . $location->uuid;
$images = [];
if ($request->hasfile("references")) { if ($request->hasfile("references")) {
foreach ($request->references as $file) { foreach ($request->references as $file) {
$path = $file->store('reference'); if (!is_dir($publicPath . $refPath)) {
array_push($images, ["path" => $path]); mkdir($publicPath . $refPath, 0755, true);
}
$filename = urlencode($file->getClientOriginalName());
$file->move($publicPath . $refPath, $filename);
//$path = $file->store('reference');
array_push($images, ["path" => '/' . $refPath . '/' . $filename]);
} }
} }
$request->merge(['images' => json_encode($images)]); if (!empty($images)) {
$request->merge(['images' => json_encode($images)]);
$location->images = json_encode($images);
}
$location->name = $request->name; $location->name = $request->name;
$location->description = $request->description; $location->description = $request->description;
$location->archive_links = $request->archive_links; $location->archive_links = $request->archive_links;
$location->images = json_encode($images);
$result = []; $result = [];
if ($location->save()) { if ($location->save()) {
return ['status' => true, 'message' => "Location Editited -IMG- " . $request->hasfile("references")]; return ['status' => true, 'message' => "Location Editited" . $request->hasfile("references")];
} else { } else {
return ['status' => false, 'message' => "Location Not Editited"]; return ['status' => false, 'message' => "Location Not Editited"];
} }

View file

@ -28,7 +28,6 @@ class SourceRepository
public function updateSourceData($index = 0) public function updateSourceData($index = 0)
{ {
//$sources = $this->getActive();
//checks all the sources to refresh data //checks all the sources to refresh data
$count = count($this->sources); $count = count($this->sources);
if ($count == 0) { if ($count == 0) {
@ -75,20 +74,16 @@ class SourceRepository
try { try {
$result = \Mastodon::domain('https://' . $source['url']) $result = \Mastodon::domain('https://' . $source['url'])
->get('/instance/domain_blocks'); ->get('/instance/domain_blocks');
//array_push($checked, ['source' => $source->url]);
} catch (ConnectException $e) { } catch (ConnectException $e) {
//dd($source); //TODO: Logo Errors
//array_push($missing, ['source' => $source->url]);
} }
} else { } else {
try { try {
$result = \Mastodon::domain('https://' . $source['url']) $result = \Mastodon::domain('https://' . $source['url'])
->token($source['token']) ->token($source['token'])
->get('/instance/domain_blocks'); ->get('/instance/domain_blocks');
//array_push($checked, ['source' => $source->url]);
} catch (ConnectException $e) { } catch (ConnectException $e) {
//array_push($missing, ['source' => $source->url]); //TODO: Logo Errors
//dd($source);
} }
} }
} elseif ($source['type'] == 'custom' && $source['format'] == 'csv') { } elseif ($source['type'] == 'custom' && $source['format'] == 'csv') {

View file

@ -24,7 +24,7 @@
<h3>Images</h3> <h3>Images</h3>
@if($images != null) @if($images != null)
@foreach($images as $image) @foreach($images as $image)
<a href="/{{$image->path}}" class="location-image" style="background: url(/{{$image->path}}) no-repeat center center / cover #fc6399" /> <a href="{{$image->path}}" class="location-image" style="background: url({{$image->path}}) no-repeat center center / cover #fc6399" />
</a> </a>
@endforeach @endforeach
@endif @endif

View file

@ -6,8 +6,6 @@
<section> <section>
<article> <article>
<h2>Member Listing </h2> <h2>Member Listing </h2>
<a href="/den/admin/update">UPDATE LOCATIONS</a><br />
<a href="/den/admin/compile">COMPILE LOCATIONS</a>
</article> </article>
</section> </section>
@endsection @endsection

View file

@ -0,0 +1,12 @@
@extends('frame')
@section('title', 'Den | Your Profile')
@section('main-content')
<section>
<article>
<h2>Edit Profile Deets </h2>
Hi. This is where you change stuff.
</article>
</section>
@endsection

View file

@ -12,7 +12,7 @@
<h3>Images</h3> <h3>Images</h3>
@if($images != null) @if($images != null)
@foreach($images as $image) @foreach($images as $image)
<a href="/{{$image->path}}" class="location-image" style="background: url(/{{$image->path}}) no-repeat center center / cover #fc6399" /> <a href="{{$image->path}}" class="location-image" style="background: url({{$image->path}}) no-repeat center center / cover #fc6399" />
</a> </a>
@endforeach @endforeach
@endif @endif
@ -21,6 +21,9 @@
$rating = floor(($action / $sources_count)*100); $rating = floor(($action / $sources_count)*100);
@endphp @endphp
<h3>Links</h3> <h3>Links</h3>
@foreach($links as $link)
<a href="{{$link}}">{{$link}}</a><br />
@endforeach
<div class="location-rating"> <div class="location-rating">
<div> <div>
<img class="rating-icon" src="/assets/images/global/heat.svg" title="heat-rating" /> <img class="rating-icon" src="/assets/images/global/heat.svg" title="heat-rating" />

View file

@ -40,6 +40,7 @@ Route::get("/logout", [AuthController::class, 'leave']);
//back //back
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("/you", [DenController::class, 'profile']);
Route::get("/member", [DenController::class, 'member']); Route::get("/member", [DenController::class, 'member']);
Route::get("/listings/{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']);