Skip to content

Commit 3c41026

Browse files
committed
w-i-p
1 parent d78297e commit 3c41026

File tree

4 files changed

+29
-20
lines changed

4 files changed

+29
-20
lines changed

packages/media/resources/views/forms/components/image-display.blade.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
22
@if($getState())
3+
<style>
4+
.custom-image-width {
5+
width: 200px;
6+
}
7+
</style>
38
<div class="flex justify-center">
49
<a href="{{ $getState() }}" target="_blank" class="flex justify-center">
5-
<img src="{{ $getState() }}" class="rounded-lg shadow-lg w-1/2 h-auto border border-gray-300"
10+
<img src="{{ $getState() }}" class="rounded-lg shadow-lg custom-image-width h-auto border border-gray-300"
611
alt="{{ $getRecord()->title ?? '' }}">
712
</a>
813
</div>

packages/media/resources/views/livewire/media-picker-modal.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ class="block w-full border-gray-300 rounded-md shadow-sm focus:ring-blue-500 foc
8282

8383
<div wire:click="toggleMediaSelection({{ $item['id'] }})"
8484
class="relative rounded-lg shadow-md overflow-hidden bg-gray-100 hover:shadow-lg transition cursor-pointer
85-
{{ in_array($item['id'], $selectedMediaIds) ? 'ring-2 ring-blue-600' : 'border border-gray-200' }}
86-
{{ $selectedMediaMeta['id'] == $item['id'] ? 'ring-4 ring-blue-700 border-2 border-blue-700' : '' }}">
85+
{{ in_array($item['id'], $selectedMediaIds) ? 'ring-2 ring-blue-600' : 'border border-gray-200' }}
86+
{{ $selectedMediaMeta['id'] == $item['id'] ? 'ring-4 ring-blue-700 border-2 border-blue-700' : '' }}">
8787
@if ($fileData)
8888
<div class="flex flex-col justify-between items-center w-full h-32 bg-gray-200">
8989
<x-filament::icon icon="{{ $fileData['icon'] }}" class="w-16 h-16 text-gray-600" />

packages/media/src/Resources/MediaResource.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,35 +55,35 @@ public static function form(Form $form): Form
5555
->schema([
5656
Placeholder::make('mime_type')
5757
->label('Dateityp')
58-
->content(fn ($record) => $record->mime_type),
58+
->content(fn($record) => $record->mime_type),
5959

6060
Placeholder::make('size')
6161
->label('Dateigröße')
62-
->content(fn ($record) => number_format($record->size / 1024, 2).' KB'),
62+
->content(fn($record) => number_format($record->size / 1024, 2) . ' KB'),
6363

6464
Placeholder::make('file_name')
6565
->label('Originaldateiname')
66-
->content(fn ($record) => $record->file_name),
66+
->content(fn($record) => $record->file_name),
6767

6868
Placeholder::make('dimensions')
6969
->label('Abmessungen')
7070
->content(function ($record) {
7171
$dimensions = $record->getCustomProperty('dimensions');
72-
if (! $dimensions) {
72+
if (!$dimensions) {
7373
return '-';
7474
}
7575

7676
return "{$dimensions['width']} × {$dimensions['height']} Pixel";
7777
})
78-
->visible(fn ($record) => str_starts_with($record->mime_type, 'image/')),
78+
->visible(fn($record) => str_starts_with($record->mime_type, 'image/')),
7979

8080
Placeholder::make('created_at')
8181
->label('Hochgeladen am')
82-
->content(fn ($record) => $record->created_at?->format('d.m.Y H:i')),
82+
->content(fn($record) => $record->created_at?->format('d.m.Y H:i')),
8383

8484
Placeholder::make('updated_at')
8585
->label('Zuletzt bearbeitet')
86-
->content(fn ($record) => $record->updated_at?->format('d.m.Y H:i')),
86+
->content(fn($record) => $record->updated_at?->format('d.m.Y H:i')),
8787

8888
Placeholder::make('usage')
8989
->label('Verwendet in')
@@ -98,7 +98,7 @@ public static function form(Form $form): Form
9898

9999
$links = $usages->map(function ($usage) {
100100
$type = Str::plural(strtolower(class_basename($usage->media_usable_type)));
101-
$url = Filament::getCurrentPanel()->getUrl().'/'.$type.'/'.$usage->media_usable_id;
101+
$url = Filament::getCurrentPanel()->getUrl() . '/' . $type . '/' . $usage->media_usable_id;
102102

103103
return Blade::render('<a href="{{ $url }}" target="_blank" class="text-primary underline">{{ $url }}</a>', [
104104
'url' => $url,
@@ -153,7 +153,7 @@ public static function table(Table $table): Table
153153
'class' => 'rounded-lg',
154154
'style' => 'width: 100%; height: auto; min-width: 150px; max-width: 250px; aspect-ratio: 1/1; object-fit: cover;',
155155
])
156-
->tooltip(fn ($record) => $record->title ?? 'Kein Titel')
156+
->tooltip(fn($record) => $record->title ?? 'Kein Titel')
157157
->searchable(['name', 'title', 'description', 'alt', 'internal_note']),
158158
]),
159159
])
@@ -170,7 +170,7 @@ public static function table(Table $table): Table
170170
->color('danger')
171171
->icon('heroicon-m-trash')
172172
->requiresConfirmation()
173-
->modalHeading(fn ($record) => 'Bild "'.($record->title ?: $record->name).'" löschen')
173+
->modalHeading(fn($record) => 'Bild "' . ($record->title ?: $record->name) . '" löschen')
174174
->modalDescription('Sind Sie sicher, dass Sie dieses Bild löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.')
175175
->modalSubmitActionLabel('Ja, löschen')
176176
->modalCancelActionLabel('Abbrechen')
@@ -191,7 +191,7 @@ public static function table(Table $table): Table
191191
'documents' => 'Dokumente',
192192
])
193193
->query(function (Builder $query, array $data) {
194-
if (! $data['value']) {
194+
if (!$data['value']) {
195195
return $query;
196196
}
197197

@@ -236,7 +236,7 @@ public static function table(Table $table): Table
236236
'year' => 'Dieses Jahr',
237237
])
238238
->query(function (Builder $query, array $data) {
239-
if (! $data['value']) {
239+
if (!$data['value']) {
240240
return $query;
241241
}
242242

@@ -259,10 +259,12 @@ public static function table(Table $table): Table
259259
}),
260260
])
261261
->defaultSort('created_at', 'desc')
262-
->paginationPageOptions([24, 48, 96])
262+
->paginationPageOptions([30, 60, 90])
263263
->contentGrid([
264264
'md' => 2,
265-
'xl' => 6,
265+
'lg' => 3,
266+
'xl' => 5,
267+
'2xl' => 6,
266268
]);
267269
}
268270

packages/media/src/Tables/Columns/CustomImageColumn.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function getState(): mixed
1212
{
1313
$record = $this->getRecord();
1414

15-
if (! $record) {
15+
if (!$record) {
1616
return null;
1717
}
1818

@@ -41,7 +41,7 @@ public function getImageUrl(?string $state = null): ?string
4141
{
4242
$record = $this->getRecord();
4343

44-
if (! $record) {
44+
if (!$record) {
4545
return null;
4646
}
4747

@@ -59,12 +59,14 @@ public function getImageUrl(?string $state = null): ?string
5959

6060
->value('media.id');
6161

62-
if (! $mediaId) {
62+
if (!$mediaId) {
6363
return null;
6464
}
6565

6666
$media = Media::find($mediaId);
6767

6868
return $media ? $media->getUrl() : null;
6969
}
70+
71+
7072
}

0 commit comments

Comments
 (0)