added url and call to action to entries migraiton and model

updated unit tests
This commit is contained in:
jon brookes 2026-01-17 16:35:14 +00:00
parent 0d688a0f82
commit 6731b4c487
5 changed files with 53 additions and 14 deletions

View file

@ -67,11 +67,11 @@ class EntryForm
$fileName = e($item->file_name);
$name = e($item->name ?? '');
$html = "<div class='flex items-center gap-3'>".
"<img src='{$url}' class='rounded' style='width:60px;height:60px;object-fit:cover;' alt='{$fileName}' loading='lazy' />".
"<div class='flex flex-col'>".
"<span class='font-medium text-sm'>{$name}</span>".
"<span class='text-xs text-gray-500'>{$fileName}</span>".
$html = "<div class='flex items-center gap-3'>" .
"<img src='{$url}' class='rounded' style='width:60px;height:60px;object-fit:cover;' alt='{$fileName}' loading='lazy' />" .
"<div class='flex flex-col'>" .
"<span class='font-medium text-sm'>{$name}</span>" .
"<span class='text-xs text-gray-500'>{$fileName}</span>" .
'</div></div>';
return [$item->id => $html];
@ -111,7 +111,7 @@ class EntryForm
}
$sourceFile = $sourceMedia->getPath();
$tempCopy = sys_get_temp_dir().'/'.uniqid().'_'.$sourceMedia->file_name;
$tempCopy = sys_get_temp_dir() . '/' . uniqid() . '_' . $sourceMedia->file_name;
copy($sourceFile, $tempCopy);
try {
@ -141,7 +141,7 @@ class EntryForm
} catch (\Exception $e) {
\Filament\Notifications\Notification::make()
->danger()
->title('Error: '.$e->getMessage())
->title('Error: ' . $e->getMessage())
->send();
} finally {
if (file_exists($tempCopy)) {
@ -163,6 +163,11 @@ class EntryForm
->toArray();
})
->searchable(),
TextInput::make('call_to_action_text')
->label('Call to Action Text'),
TextInput::make('call_to_action_link')
->label('Call to Action URL'),
RichEditor::make('content')
->columnSpanFull()
->hintAction(
@ -193,11 +198,11 @@ class EntryForm
$name = e($item->name ?? '');
// Smaller image preview for better performance
$html = "<div class='flex items-center gap-3'>".
"<img src='{$url}' class='rounded' style='width:60px;height:60px;object-fit:cover;' alt='{$fileName}' loading='lazy' />".
"<div class='flex flex-col'>".
"<span class='font-medium text-sm'>{$name}</span>".
"<span class='text-xs text-gray-500'>{$fileName}</span>".
$html = "<div class='flex items-center gap-3'>" .
"<img src='{$url}' class='rounded' style='width:60px;height:60px;object-fit:cover;' alt='{$fileName}' loading='lazy' />" .
"<div class='flex flex-col'>" .
"<span class='font-medium text-sm'>{$name}</span>" .
"<span class='text-xs text-gray-500'>{$fileName}</span>" .
'</div></div>';
return [$url => $html];