Titelbild im Profil, durchsuchbare Baum-Auswahl im IT-Ticket (0.20.1)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m47s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m41s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m8s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m6s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m25s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m23s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m39s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m40s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m8s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m47s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m41s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m8s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m6s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m25s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m23s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m39s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m40s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m8s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2f03597b89
commit
05b4b79cb3
146 changed files with 1051 additions and 495 deletions
|
|
@ -12,7 +12,7 @@ class AppearanceAdvanced extends AppearancePage
|
|||
|
||||
protected static int $formColumns = 1;
|
||||
|
||||
protected static ?int $navigationSort = 6;
|
||||
protected static ?int $navigationSort = 7;
|
||||
|
||||
protected static ?string $navigationLabel = 'Erweitert';
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class AppearanceFooter extends AppearancePage
|
|||
|
||||
protected static int $formColumns = 1;
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
protected static ?int $navigationSort = 6;
|
||||
|
||||
protected static ?string $navigationLabel = 'Fußzeile & E-Mails';
|
||||
|
||||
|
|
|
|||
32
app/Filament/Pages/Appearance/AppearanceProfile.php
Normal file
32
app/Filament/Pages/Appearance/AppearanceProfile.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Appearance;
|
||||
|
||||
use App\Support\Theme\Theme;
|
||||
use BackedEnum;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class AppearanceProfile extends AppearancePage
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedUserCircle;
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
protected static ?string $navigationLabel = 'Profile';
|
||||
|
||||
protected static ?string $title = 'Profile';
|
||||
|
||||
protected static ?string $slug = 'profile';
|
||||
|
||||
protected function fields(): array
|
||||
{
|
||||
return [
|
||||
static::image('profile_cover', 'Standard-Titelbild', 'Erscheint oben im Profil und in der Begrüßung auf der Startseite, wenn eine Person kein eigenes Titelbild hochgeladen hat. Querformat, mindestens 1600 Pixel breit. Leer = Fläche in der Markenfarbe.')
|
||||
->image()->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])->maxSize(8192)->columnSpanFull(),
|
||||
Radio::make('profile_cover_overlay')->label('Farbfläche über dem Titelbild')
|
||||
->helperText('Titelbilder liegen immer unter einer leicht durchsichtigen Fläche in der Markenfarbe – so bleiben Name und Text gut lesbar und alle Profile wirken einheitlich.')
|
||||
->options(Theme::COVER_OVERLAYS)->inline()->required()->columnSpanFull(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -125,6 +125,7 @@ class PeopleController extends Controller
|
|||
'about' => $user->about,
|
||||
'fields' => app(ProfileFields::class)->visibleValues($user, auth()->user()),
|
||||
'avatar_url' => $user->avatarUrl(256),
|
||||
'cover_url' => $user->coverUrl(),
|
||||
'manager' => $user->manager?->is_active ? [
|
||||
'id' => $user->manager->id,
|
||||
'name' => $user->manager->name,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use App\Http\Requests\UpdateProfileRequest;
|
|||
use App\Models\User;
|
||||
use App\Profile\ProfileSections;
|
||||
use App\Support\Avatars;
|
||||
use App\Support\Covers;
|
||||
use App\Support\ProfileFields;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
|
@ -37,6 +38,7 @@ class ProfileController extends Controller
|
|||
'name' => $user->name,
|
||||
'initials' => $user->initials,
|
||||
'avatar_url' => $user->avatarUrl(256),
|
||||
'cover_url' => $user->coverUrl(),
|
||||
'has_password' => $user->password !== null,
|
||||
],
|
||||
// Felder, die Microsoft Entra ID pflegt – im Portal nur lesbar.
|
||||
|
|
@ -92,6 +94,36 @@ class ProfileController extends Controller
|
|||
return back()->with('status', 'avatar-deleted');
|
||||
}
|
||||
|
||||
public function updateCover(Request $request, Covers $covers): RedirectResponse
|
||||
{
|
||||
$request->validate([
|
||||
'cover' => ['required', File::image()->types(['jpg', 'jpeg', 'png', 'webp'])->max(8 * 1024)],
|
||||
]);
|
||||
|
||||
try {
|
||||
$covers->store($request->user(), $request->file('cover'));
|
||||
} catch (Throwable $e) {
|
||||
report($e);
|
||||
|
||||
$message = 'Das Titelbild konnte nicht gespeichert werden. Bitte ein anderes Bild versuchen oder die Administration informieren.';
|
||||
|
||||
if ($request->user()->can('updates.manage')) {
|
||||
$message .= ' Technischer Grund: '.class_basename($e).': '.$e->getMessage();
|
||||
}
|
||||
|
||||
throw ValidationException::withMessages(['cover' => $message]);
|
||||
}
|
||||
|
||||
return back()->with('status', 'cover-updated');
|
||||
}
|
||||
|
||||
public function destroyCover(Request $request, Covers $covers): RedirectResponse
|
||||
{
|
||||
$covers->delete($request->user());
|
||||
|
||||
return back()->with('status', 'cover-deleted');
|
||||
}
|
||||
|
||||
public function updateTheme(Request $request): RedirectResponse
|
||||
{
|
||||
$validated = $request->validate([
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ class HandleInertiaRequests extends Middleware
|
|||
'initials' => $user->initials,
|
||||
'job_title' => $user->job_title,
|
||||
'avatar_url' => $user->avatarUrl(96),
|
||||
'cover_url' => $user->coverUrl(),
|
||||
'theme' => $user->theme,
|
||||
'can_admin' => $user->canAccessAdmin(),
|
||||
] : null,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\Support\Avatars;
|
||||
use App\Support\Covers;
|
||||
use App\Support\Permissions\Permissions;
|
||||
use App\Support\Permissions\PermissionSet;
|
||||
use Database\Factories\UserFactory;
|
||||
|
|
@ -164,6 +165,12 @@ class User extends Authenticatable implements FilamentUser, HasAvatar
|
|||
return app(Avatars::class)->url($this, $size);
|
||||
}
|
||||
|
||||
/** Eigenes Titelbild im Profil (ohne: Standardbild aus dem Erscheinungsbild) */
|
||||
public function coverUrl(): ?string
|
||||
{
|
||||
return app(Covers::class)->url($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute<string, never>
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -177,6 +177,11 @@ class Branding
|
|||
'text' => $theme['login_text'],
|
||||
'image_url' => $this->url($theme['login_image']),
|
||||
],
|
||||
// Titelbild in Profil und Begrüßung: eigenes Bild der Person, sonst dieses – immer mit Farbfläche darüber
|
||||
'profile_cover' => [
|
||||
'image_url' => $this->url($theme['profile_cover']),
|
||||
'overlay' => $theme['profile_cover_overlay'] / 100,
|
||||
],
|
||||
'footer' => [
|
||||
'text' => $theme['footer_text'],
|
||||
'links' => $theme['footer_links'],
|
||||
|
|
|
|||
57
app/Support/Covers.php
Normal file
57
app/Support/Covers.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Intervention\Image\Drivers\Gd\Driver;
|
||||
use Intervention\Image\Encoders\WebpEncoder;
|
||||
use Intervention\Image\ImageManager;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Titelbilder im Profil (der farbige Streifen oben). Gespeichert als ein WebP im
|
||||
* Querformat im öffentlichen Upload-Verzeichnis – wie die Profilbilder (siehe Avatars).
|
||||
*/
|
||||
class Covers
|
||||
{
|
||||
public const WIDTH = 1600;
|
||||
|
||||
public const HEIGHT = 500;
|
||||
|
||||
public function store(User $user, UploadedFile $file): void
|
||||
{
|
||||
Images::withLocalCopy($file, function (string $path) use ($user) {
|
||||
Images::raiseMemoryLimitFor($path);
|
||||
$image = ImageManager::usingDriver(Driver::class)->decodePath($path);
|
||||
$file = 'covers/'.$user->getKey().'/'.Str::random(12).'.webp';
|
||||
|
||||
// Zuschnitt 16:5 – breit genug für das Profil, die Begrüßung zeigt die Mitte
|
||||
$image->cover(self::WIDTH, self::HEIGHT);
|
||||
|
||||
if (! Storage::disk('uploads')->put($file, $image->encode(new WebpEncoder(quality: 82))->toString())) {
|
||||
throw new RuntimeException('Titelbild konnte nicht gespeichert werden – ist public/uploads beschreibbar?');
|
||||
}
|
||||
|
||||
$this->delete($user);
|
||||
$user->forceFill(['cover_path' => $file])->save();
|
||||
});
|
||||
}
|
||||
|
||||
public function delete(User $user): void
|
||||
{
|
||||
if ($user->cover_path === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Storage::disk('uploads')->delete($user->cover_path);
|
||||
$user->forceFill(['cover_path' => null])->save();
|
||||
}
|
||||
|
||||
public function url(User $user): ?string
|
||||
{
|
||||
return $user->cover_path ? Storage::disk('uploads')->url($user->cover_path) : null;
|
||||
}
|
||||
}
|
||||
|
|
@ -32,6 +32,8 @@ class Theme
|
|||
'login_title' => 'Alles Wichtige für Ihren Arbeitsalltag – an einem Ort.',
|
||||
'login_text' => null,
|
||||
'login_image' => null,
|
||||
'profile_cover' => null,
|
||||
'profile_cover_overlay' => 70,
|
||||
'footer_text' => null,
|
||||
'footer_links' => [],
|
||||
'email_footer' => null,
|
||||
|
|
@ -51,6 +53,8 @@ class Theme
|
|||
'dark' => 'Immer dunkel',
|
||||
];
|
||||
|
||||
public const COVER_OVERLAYS = [40 => 'Leicht (40 %)', 55 => 'Mittel (55 %)', 70 => 'Kräftig (70 %)', 85 => 'Sehr kräftig (85 %)'];
|
||||
|
||||
public const LOGIN_LAYOUTS = ['split' => 'Geteilt: Bild bzw. Markenfarbe links, Anmeldung rechts', 'centered' => 'Zentriert: Anmeldung vor dem Hintergrundbild'];
|
||||
|
||||
private const PUBLISHED = 'theme.published';
|
||||
|
|
@ -153,6 +157,7 @@ class Theme
|
|||
$theme['radius'] = array_key_exists($theme['radius'], self::RADII) ? $theme['radius'] : 'medium';
|
||||
$theme['density'] = array_key_exists($theme['density'], self::DENSITIES) ? $theme['density'] : 'normal';
|
||||
$theme['dark_mode'] = array_key_exists($theme['dark_mode'], self::DARK_MODES) ? $theme['dark_mode'] : 'user';
|
||||
$theme['profile_cover_overlay'] = array_key_exists((int) $theme['profile_cover_overlay'], self::COVER_OVERLAYS) ? (int) $theme['profile_cover_overlay'] : 70;
|
||||
$theme['login_layout'] = array_key_exists($theme['login_layout'], self::LOGIN_LAYOUTS) ? $theme['login_layout'] : 'split';
|
||||
$theme['footer_links'] = array_values(array_filter(array_map(
|
||||
fn ($link) => is_array($link) && filled($link['label'] ?? null) && filled($link['url'] ?? null)
|
||||
|
|
@ -166,7 +171,7 @@ class Theme
|
|||
$theme[$text] = filled($theme[$text]) ? mb_substr(trim((string) $theme[$text]), 0, 500) : null;
|
||||
}
|
||||
|
||||
foreach (['logo_light', 'logo_dark', 'logo_mark', 'app_icon', 'login_image', 'custom_font'] as $file) {
|
||||
foreach (['logo_light', 'logo_dark', 'logo_mark', 'app_icon', 'login_image', 'profile_cover', 'custom_font'] as $file) {
|
||||
$theme[$file] = is_string($theme[$file]) && preg_match('#^(theme|branding)/[A-Za-z0-9/_.-]+$#', $theme[$file]) && ! str_contains($theme[$file], '..') ? $theme[$file] : null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class ThemeTransfer
|
|||
{
|
||||
public const FORMAT = 'inhaus-theme';
|
||||
|
||||
private const FILES = ['logo_light', 'logo_dark', 'logo_mark', 'app_icon', 'login_image', 'custom_font'];
|
||||
private const FILES = ['logo_light', 'logo_dark', 'logo_mark', 'app_icon', 'login_image', 'profile_cover', 'custom_font'];
|
||||
|
||||
private const MIME = [
|
||||
'image/svg+xml' => 'svg', 'image/png' => 'png', 'image/jpeg' => 'jpg', 'image/webp' => 'webp', 'font/woff2' => 'woff2',
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@ namespace App;
|
|||
*/
|
||||
final class Version
|
||||
{
|
||||
public const VERSION = '0.20.0';
|
||||
public const VERSION = '0.20.1';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue