mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
add dedicated Bindle page
This commit is contained in:
39
app/Http/Livewire/Bindle/Gallery.php
Normal file
39
app/Http/Livewire/Bindle/Gallery.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Livewire\Bindle;
|
||||||
|
|
||||||
|
use App\Models\LibraryItem;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
use Livewire\Component;
|
||||||
|
use RalphJSmit\Laravel\SEO\Support\SEOData;
|
||||||
|
|
||||||
|
class Gallery extends Component
|
||||||
|
{
|
||||||
|
public Collection $bindles;
|
||||||
|
|
||||||
|
public function mount()
|
||||||
|
{
|
||||||
|
$this->bindles = LibraryItem::query()
|
||||||
|
->where('type', 'bindle')
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteBindle($id)
|
||||||
|
{
|
||||||
|
LibraryItem::query()->find($id)?->delete();
|
||||||
|
|
||||||
|
return to_route('bindles');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('livewire.bindle.gallery')
|
||||||
|
->layout('layouts.app', [
|
||||||
|
'SEOData' => new SEOData(
|
||||||
|
title: __('Bindle Gallery'),
|
||||||
|
description: __('Die berühmte Bindlesammlung von FiatTracker.'),
|
||||||
|
image: asset('img/fiat_tracker.jpg'),
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,6 @@ use App\Enums\LibraryItemType;
|
|||||||
use App\Models\Country;
|
use App\Models\Country;
|
||||||
use App\Models\Library;
|
use App\Models\Library;
|
||||||
use App\Models\LibraryItem;
|
use App\Models\LibraryItem;
|
||||||
use App\Models\Tag;
|
|
||||||
use App\Traits\HasTagsTrait;
|
use App\Traits\HasTagsTrait;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
@@ -59,10 +58,34 @@ class LibraryItemForm extends Component
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
'libraryItem.subtitle' => 'required',
|
'libraryItem.subtitle' => 'required',
|
||||||
'libraryItem.excerpt' => 'required',
|
'libraryItem.excerpt' =>
|
||||||
'libraryItem.main_image_caption' => 'required',
|
[
|
||||||
'libraryItem.read_time' => 'required',
|
Rule::when(
|
||||||
'libraryItem.approved' => 'boolean',
|
$this->libraryItem->type !== 'bindle',
|
||||||
|
'required',
|
||||||
|
)
|
||||||
|
],
|
||||||
|
'libraryItem.main_image_caption' =>
|
||||||
|
[
|
||||||
|
Rule::when(
|
||||||
|
$this->libraryItem->type !== 'bindle',
|
||||||
|
'required',
|
||||||
|
)
|
||||||
|
],
|
||||||
|
'libraryItem.read_time' =>
|
||||||
|
[
|
||||||
|
Rule::when(
|
||||||
|
$this->libraryItem->type !== 'bindle',
|
||||||
|
'required',
|
||||||
|
)
|
||||||
|
],
|
||||||
|
'libraryItem.approved' =>
|
||||||
|
[
|
||||||
|
Rule::when(
|
||||||
|
$this->libraryItem->type !== 'bindle',
|
||||||
|
'required',
|
||||||
|
)
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,25 +142,42 @@ class LibraryItemForm extends Component
|
|||||||
$this->libraryItem->libraries()
|
$this->libraryItem->libraries()
|
||||||
->syncWithoutDetaching([(int)$this->library]);
|
->syncWithoutDetaching([(int)$this->library]);
|
||||||
|
|
||||||
|
if ($this->libraryItem->type === 'bindle') {
|
||||||
|
return to_route('bindles');
|
||||||
|
}
|
||||||
|
|
||||||
return to_route('library.table.libraryItems', ['country' => $this->country]);
|
return to_route('library.table.libraryItems', ['country' => $this->country]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
return view('livewire.library.form.library-item-form', [
|
$types = Options::forEnum(LibraryItemType::class)
|
||||||
'types' => Options::forEnum(LibraryItemType::class)
|
|
||||||
->filter(
|
->filter(
|
||||||
fn($type) => $type !== LibraryItemType::PodcastEpisode
|
fn($type) => $type !== LibraryItemType::PodcastEpisode
|
||||||
&& $type !== LibraryItemType::MarkdownArticle
|
&& $type !== LibraryItemType::MarkdownArticle
|
||||||
)
|
)
|
||||||
->toArray(),
|
->toArray();
|
||||||
'libraries' => Library::query()
|
$libaries = Library::query()
|
||||||
|
->when(auth()->id() !== config('portal.bonus.fiat-tracker-user-id'),
|
||||||
|
fn($query) => $query->where('name', '!=', 'Bindle')
|
||||||
|
)
|
||||||
->get()
|
->get()
|
||||||
->map(fn($library) => [
|
->map(fn($library) => [
|
||||||
'id' => $library->id,
|
'id' => $library->id,
|
||||||
'name' => $library->name,
|
'name' => $library->name,
|
||||||
])
|
])
|
||||||
->toArray(),
|
->toArray();
|
||||||
|
|
||||||
|
if (auth()->id() === config('portal.bonus.fiat-tracker-user-id')) {
|
||||||
|
$types = collect($types)->prepend([
|
||||||
|
'label' => 'Bindle',
|
||||||
|
'value' => 'bindle',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('livewire.library.form.library-item-form', [
|
||||||
|
'types' => $types,
|
||||||
|
'libraries' => $libaries,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ class LibraryTable extends Component
|
|||||||
{
|
{
|
||||||
$shouldBePublic = !$this->isLecturerPage;
|
$shouldBePublic = !$this->isLecturerPage;
|
||||||
$libraries = \App\Models\Library::query()
|
$libraries = \App\Models\Library::query()
|
||||||
|
->where('name', '!=', 'Bindle')
|
||||||
->whereNull('parent_id')
|
->whereNull('parent_id')
|
||||||
->where('is_public', $shouldBePublic)
|
->where('is_public', $shouldBePublic)
|
||||||
->orderBy('name')
|
->orderBy('name')
|
||||||
@@ -90,6 +91,7 @@ class LibraryTable extends Component
|
|||||||
'lecturer',
|
'lecturer',
|
||||||
'tags',
|
'tags',
|
||||||
])
|
])
|
||||||
|
->where('type', '!=', 'bindle')
|
||||||
->when($this->search, fn($query) => $query
|
->when($this->search, fn($query) => $query
|
||||||
->where('name', 'ilike', '%' . $this->search . '%')
|
->where('name', 'ilike', '%' . $this->search . '%')
|
||||||
->orWhere(fn($query) => $query
|
->orWhere(fn($query) => $query
|
||||||
|
|||||||
6
config/portal/bonus.php
Normal file
6
config/portal/bonus.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
'fiat-tracker-user-id' => env('FIAT_TRACKER_USER_ID', 1),
|
||||||
|
];
|
||||||
BIN
public/img/fiat_tracker.jpg
Normal file
BIN
public/img/fiat_tracker.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
90
resources/views/livewire/bindle/gallery.blade.php
Normal file
90
resources/views/livewire/bindle/gallery.blade.php
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<div class="bg-21gray flex flex-col h-screen">
|
||||||
|
{{-- HEADER --}}
|
||||||
|
<livewire:frontend.header :country="null"/>
|
||||||
|
|
||||||
|
<div class="mx-auto max-w-screen-2xl px-4 py-10 sm:px-6 lg:px-8">
|
||||||
|
|
||||||
|
<div class="flex">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div class="py-6">
|
||||||
|
@if(auth()->id() === config('portal.bonus.fiat-tracker-user-id'))
|
||||||
|
<x-button icon="plus"
|
||||||
|
:href="route('library.libraryItem.form', ['country' => 'de'])">
|
||||||
|
{{ __('Neues Bindle hochladen') }}
|
||||||
|
</x-button>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h1 class="text-4xl text-white py-8">Sent from my #₿indle🧡</h1>
|
||||||
|
|
||||||
|
<ul role="list"
|
||||||
|
class="grid grid-cols-2 gap-x-4 gap-y-8 sm:grid-cols-3 sm:gap-x-6 lg:grid-cols-4 xl:gap-x-8">
|
||||||
|
|
||||||
|
@foreach($bindles as $bindle)
|
||||||
|
<li wire:key="image_{{ $bindle->id }}">
|
||||||
|
<div>
|
||||||
|
<div
|
||||||
|
class="aspect-h-7 aspect-w-10 block w-full rounded-lg bg-gray-100">
|
||||||
|
<a target="_blank" href="{{ $bindle->getFirstMediaUrl('main') }}">
|
||||||
|
<img src="{{ $bindle->getFirstMediaUrl('main') }}" alt="{{ $bindle->name }}"
|
||||||
|
class="object-cover">
|
||||||
|
</a>
|
||||||
|
<button type="button" class="absolute inset-0 focus:outline-none">
|
||||||
|
<span class="sr-only">{{ $bindle->name }}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<p class="mt-2 block truncate text-sm font-medium text-gray-100">{{ $bindle->name }}</p>
|
||||||
|
<div>
|
||||||
|
<a href="{{ $bindle->value }}" target="_blank" class="text-md font-medium text-gray-100">{{ $bindle->value }}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-sm font-medium text-gray-100 py-4">
|
||||||
|
@if(auth()->id() === config('portal.bonus.fiat-tracker-user-id'))
|
||||||
|
<x-button
|
||||||
|
negative
|
||||||
|
xs
|
||||||
|
icon="trash"
|
||||||
|
label="{{ __('Delete') }}"
|
||||||
|
x-on:confirm="{
|
||||||
|
title: 'Are you sure you want to delete this bindle?',
|
||||||
|
icon: 'warning',
|
||||||
|
method: 'deleteBindle',
|
||||||
|
params: {{ $bindle->id }}
|
||||||
|
}"
|
||||||
|
/>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div wire:ignore>
|
||||||
|
<div
|
||||||
|
class="flex flex-col justify-center text-center space-x-4 py-4 mt-4">
|
||||||
|
|
||||||
|
<h1 class="text-2xl text-gray-200">value-4-value</h1>
|
||||||
|
<div wire:ignore>
|
||||||
|
<lightning-widget
|
||||||
|
name="fiattracker"
|
||||||
|
accent="#f7931a"
|
||||||
|
to="fiattracker@current.tips"
|
||||||
|
image="https://primal.b-cdn.net/media-cache?s=m&a=1&u=https%3A%2F%2Fphoto.starbackr.com%2F6398268f7354d37fe0b31829%2Fprofile%2F1674719214461.jpg"
|
||||||
|
amounts="21,210,2100,21000"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://embed.twentyuno.net/js/app.js"></script>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -57,6 +57,12 @@
|
|||||||
{{ __('Podcast Episodes') }}
|
{{ __('Podcast Episodes') }}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<a href="{{ route('bindles', ['country' => null]) }}"
|
||||||
|
class="flex gap-x-4 py-2 text-sm font-semibold leading-6 text-gray-900">
|
||||||
|
<i class="fa-thin fa-image flex-none text-gray-400 w-6 h-5 mr-2 -ml-1"></i>
|
||||||
|
{{ __('Bindles') }}
|
||||||
|
</a>
|
||||||
|
|
||||||
@auth
|
@auth
|
||||||
<a href="{{ route('library.table.lecturer', ['country' => $country]) }}"
|
<a href="{{ route('library.table.lecturer', ['country' => $country]) }}"
|
||||||
class="flex gap-x-4 py-2 text-sm font-semibold leading-6 text-gray-900">
|
class="flex gap-x-4 py-2 text-sm font-semibold leading-6 text-gray-900">
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ Route::middleware([])
|
|||||||
->get('/kaninchenbau', \App\Http\Livewire\Helper\FollowTheRabbit::class)
|
->get('/kaninchenbau', \App\Http\Livewire\Helper\FollowTheRabbit::class)
|
||||||
->name('kaninchenbau');
|
->name('kaninchenbau');
|
||||||
|
|
||||||
|
Route::middleware([])
|
||||||
|
->get('/bindles', \App\Http\Livewire\Bindle\Gallery::class)
|
||||||
|
->name('bindles');
|
||||||
|
|
||||||
Route::get('/img/{path}', \App\Http\Controllers\ImageController::class)
|
Route::get('/img/{path}', \App\Http\Controllers\ImageController::class)
|
||||||
->where('path', '.*')
|
->where('path', '.*')
|
||||||
->name('img');
|
->name('img');
|
||||||
|
|||||||
Reference in New Issue
Block a user