Backend: eigenes kompaktes Theme, Übersicht, Cluster mit Unterseiten, Plugin-Liste
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m29s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m31s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m56s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m2s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m20s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m22s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m42s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m41s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m18s
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m29s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m31s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m56s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m2s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m20s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m22s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m42s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m41s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m18s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ff4a26ecb4
commit
c495dfa1cb
144 changed files with 1601 additions and 813 deletions
31
app/Filament/Pages/Appearance/AppearanceAdvanced.php
Normal file
31
app/Filament/Pages/Appearance/AppearanceAdvanced.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Appearance;
|
||||
|
||||
use BackedEnum;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class AppearanceAdvanced extends AppearancePage
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCodeBracket;
|
||||
|
||||
protected static int $formColumns = 1;
|
||||
|
||||
protected static ?int $navigationSort = 6;
|
||||
|
||||
protected static ?string $navigationLabel = 'Erweitert';
|
||||
|
||||
protected static ?string $title = 'Erweitert';
|
||||
|
||||
protected static ?string $slug = 'erweitert';
|
||||
|
||||
protected function fields(): array
|
||||
{
|
||||
return [
|
||||
Textarea::make('custom_css')->label('Eigenes CSS')->rows(12)->maxLength(50000)
|
||||
->extraInputAttributes(['class' => 'font-mono text-xs', 'spellcheck' => 'false'])
|
||||
->helperText('Für Fortgeschrittene. Wird nach dem Portal-CSS geladen und bei Aktualisierungen unverändert übernommen. Klassennamen können sich mit neuen Versionen ändern – bitte nach jedem Update prüfen. Verfügbare Variablen: --brand, --brand-50 … --brand-950, --radius, --font-body, --font-heading.'),
|
||||
];
|
||||
}
|
||||
}
|
||||
39
app/Filament/Pages/Appearance/AppearanceColors.php
Normal file
39
app/Filament/Pages/Appearance/AppearanceColors.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Appearance;
|
||||
|
||||
use App\Support\Theme\Theme;
|
||||
use BackedEnum;
|
||||
use Filament\Forms\Components\ColorPicker;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Components\Text;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class AppearanceColors extends AppearancePage
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedSwatch;
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
protected static ?string $navigationLabel = 'Farben';
|
||||
|
||||
protected static ?string $title = 'Farben';
|
||||
|
||||
protected static ?string $slug = 'farben';
|
||||
|
||||
protected function fields(): array
|
||||
{
|
||||
return [
|
||||
ColorPicker::make('primary_color')->label('Markenfarbe')->required()->regex('/^#[0-9a-fA-F]{6}$/')->live(onBlur: true)
|
||||
->helperText('Wird exakt übernommen: Schaltflächen, aktive Navigation, Begrüßungskarte. Die Abstufungen werden berechnet.'),
|
||||
ColorPicker::make('secondary_color')->label('Zweite Akzentfarbe (optional)')->regex('/^#[0-9a-fA-F]{6}$/')->live(onBlur: true)
|
||||
->helperText('Für Kategorien und Datumsangaben. Leer = Markenfarbe.'),
|
||||
Radio::make('header_style')->label('Kopfleiste')->options(Theme::HEADER_STYLES)->inline()->required()->columnSpanFull(),
|
||||
Section::make('Kontrastprüfung (WCAG AA)')->columnSpanFull()->compact()->schema([
|
||||
Text::make(fn (Get $get) => $this->contrastReport((string) $get('primary_color'), $get('secondary_color'))),
|
||||
]),
|
||||
];
|
||||
}
|
||||
}
|
||||
39
app/Filament/Pages/Appearance/AppearanceFooter.php
Normal file
39
app/Filament/Pages/Appearance/AppearanceFooter.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Appearance;
|
||||
|
||||
use BackedEnum;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class AppearanceFooter extends AppearancePage
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedEnvelope;
|
||||
|
||||
protected static int $formColumns = 1;
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
protected static ?string $navigationLabel = 'Fußzeile & E-Mails';
|
||||
|
||||
protected static ?string $title = 'Fußzeile & E-Mails';
|
||||
|
||||
protected static ?string $slug = 'fusszeile';
|
||||
|
||||
protected function fields(): array
|
||||
{
|
||||
return [
|
||||
TextInput::make('footer_text')->label('Text in der Fußzeile')->placeholder('© 2027 Musterstift gGmbH')->maxLength(200),
|
||||
Repeater::make('footer_links')->label('Links in der Fußzeile')->columns(2)->defaultItems(0)->reorderable()
|
||||
->addActionLabel('Link hinzufügen')->maxItems(8)
|
||||
->schema([
|
||||
TextInput::make('label')->label('Bezeichnung')->required()->maxLength(60)->placeholder('Impressum'),
|
||||
TextInput::make('url')->label('Adresse')->required()->maxLength(500)->placeholder('https://… oder /seiten/impressum'),
|
||||
]),
|
||||
Textarea::make('email_footer')->label('Fußzeile in E-Mails')->rows(3)->maxLength(500)
|
||||
->helperText('Z. B. Anschrift und Hinweis. Logo und Markenfarbe übernehmen die E-Mails automatisch.'),
|
||||
];
|
||||
}
|
||||
}
|
||||
36
app/Filament/Pages/Appearance/AppearanceIdentity.php
Normal file
36
app/Filament/Pages/Appearance/AppearanceIdentity.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Appearance;
|
||||
|
||||
use BackedEnum;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class AppearanceIdentity extends AppearancePage
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedIdentification;
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
protected static ?string $navigationLabel = 'Identität & Logos';
|
||||
|
||||
protected static ?string $title = 'Identität & Logos';
|
||||
|
||||
protected static ?string $slug = 'identitaet';
|
||||
|
||||
protected function fields(): array
|
||||
{
|
||||
return [
|
||||
TextInput::make('portal_name')->label('Name des Portals')->required()->maxLength(60)
|
||||
->helperText('Erscheint im Kopfbereich, im Browser-Tab, in E-Mails und auf dem Homescreen.')->columnSpanFull(),
|
||||
static::image('logo_light', 'Logo für helle Flächen', 'SVG, PNG oder WebP mit transparentem Hintergrund.')
|
||||
->acceptedFileTypes(['image/svg+xml', 'image/png', 'image/webp']),
|
||||
static::image('logo_dark', 'Logo für dunkle Flächen', 'Für den Dunkelmodus und farbige Kopfleisten, z. B. in Weiß. Leer = wie hell.')
|
||||
->acceptedFileTypes(['image/svg+xml', 'image/png', 'image/webp']),
|
||||
static::image('logo_mark', 'Signet (quadratisch)', 'Kurzform für Smartphones, z. B. nur das Bildzeichen.')
|
||||
->acceptedFileTypes(['image/svg+xml', 'image/png', 'image/webp']),
|
||||
static::image('app_icon', 'App-Symbol', 'Quadratisch, mindestens 512 × 512 Pixel (PNG oder JPG). Daraus entstehen Favicon und Homescreen-Symbole.')
|
||||
->image()->acceptedFileTypes(['image/png', 'image/jpeg', 'image/webp']),
|
||||
];
|
||||
}
|
||||
}
|
||||
34
app/Filament/Pages/Appearance/AppearanceLogin.php
Normal file
34
app/Filament/Pages/Appearance/AppearanceLogin.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Appearance;
|
||||
|
||||
use App\Support\Theme\Theme;
|
||||
use BackedEnum;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class AppearanceLogin extends AppearancePage
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedArrowRightOnRectangle;
|
||||
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
protected static ?string $navigationLabel = 'Anmeldeseite';
|
||||
|
||||
protected static ?string $title = 'Anmeldeseite';
|
||||
|
||||
protected static ?string $slug = 'anmeldeseite';
|
||||
|
||||
protected function fields(): array
|
||||
{
|
||||
return [
|
||||
Radio::make('login_layout')->label('Aufteilung')->options(Theme::LOGIN_LAYOUTS)->required()->columnSpanFull(),
|
||||
TextInput::make('login_title')->label('Begrüßung')->maxLength(200)->columnSpanFull(),
|
||||
Textarea::make('login_text')->label('Text darunter')->rows(2)->maxLength(500)->columnSpanFull(),
|
||||
static::image('login_image', 'Hintergrundbild', 'Querformat, mindestens 1600 Pixel breit. Leer = Fläche in der Markenfarbe.')
|
||||
->image()->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])->maxSize(8192)->columnSpanFull(),
|
||||
];
|
||||
}
|
||||
}
|
||||
174
app/Filament/Pages/Appearance/AppearancePage.php
Normal file
174
app/Filament/Pages/Appearance/AppearancePage.php
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Appearance;
|
||||
|
||||
use App\Filament\Clusters\AppearanceCluster;
|
||||
use App\Support\Audit;
|
||||
use App\Support\Branding;
|
||||
use App\Support\Theme\Contrast;
|
||||
use App\Support\Theme\Icons;
|
||||
use App\Support\Theme\Theme;
|
||||
use App\Support\Theme\ThemeCompiler;
|
||||
use App\Support\Theme\ThemeTransfer;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\ActionGroup;
|
||||
use Filament\Forms\Components\Field;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Schemas\Components\Component;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* „Erscheinungsbild“ (docs/PLAN.md, Abschnitt 12): Entwurf bearbeiten, in der
|
||||
* Vorschau ansehen, dann für alle veröffentlichen. Jede Unterseite zeigt nur
|
||||
* ihre Felder; gespeichert wird immer in denselben Entwurf (saveDraft führt zusammen).
|
||||
*/
|
||||
abstract class AppearancePage extends Page
|
||||
{
|
||||
protected static ?string $cluster = AppearanceCluster::class;
|
||||
|
||||
/** Spalten des Formulars (einspaltig für längere Texte) */
|
||||
protected static int $formColumns = 2;
|
||||
|
||||
/**
|
||||
* Felder dieser Unterseite.
|
||||
*
|
||||
* @return array<int, Component|Field>
|
||||
*/
|
||||
abstract protected function fields(): array;
|
||||
|
||||
protected static function image(string $name, string $label, string $help): FileUpload
|
||||
{
|
||||
return FileUpload::make($name)->label($label)->helperText($help)
|
||||
->disk('uploads')->directory('theme')->visibility('public')->maxSize(4096);
|
||||
}
|
||||
|
||||
protected string $view = 'filament.pages.appearance';
|
||||
|
||||
/** @var array<string, mixed>|null */
|
||||
public ?array $data = [];
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return auth()->user()?->can('appearance.manage') ?? false;
|
||||
}
|
||||
|
||||
public function mount(Theme $theme): void
|
||||
{
|
||||
$this->form->fill($theme->working());
|
||||
}
|
||||
|
||||
public function hasDraft(): bool
|
||||
{
|
||||
return app(Theme::class)->hasDraft();
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->statePath('data')->columns(static::$formColumns)->components($this->fields());
|
||||
}
|
||||
|
||||
protected function contrastReport(string $primary, ?string $secondary): HtmlString
|
||||
{
|
||||
if (! preg_match('/^#[0-9a-fA-F]{6}$/', $primary)) {
|
||||
return new HtmlString('');
|
||||
}
|
||||
|
||||
$colors = ['ok' => '#15803d', 'info' => '#0369a1', 'warning' => '#b45309'];
|
||||
$icons = ['ok' => '✓', 'info' => 'i', 'warning' => '!'];
|
||||
|
||||
return new HtmlString(collect(Contrast::report(strtoupper($primary), $secondary && preg_match('/^#[0-9a-fA-F]{6}$/', $secondary) ? strtoupper($secondary) : null))
|
||||
->map(fn ($note) => '<p style="display:flex;gap:.5rem;margin:.25rem 0"><span style="font-weight:700;color:'.$colors[$note['level']].';width:1rem;text-align:center">'.$icons[$note['level']].'</span><span>'.e($note['text']).'</span></p>')
|
||||
->implode(''));
|
||||
}
|
||||
|
||||
/**
|
||||
* Entwurf speichern und die Vorschau aktualisieren.
|
||||
*/
|
||||
public function save(Theme $theme, Branding $branding): void
|
||||
{
|
||||
$theme->saveDraft($this->form->getState());
|
||||
session()->put(Branding::PREVIEW_SESSION_KEY, true);
|
||||
$branding->refresh();
|
||||
|
||||
$this->dispatch('theme-preview-reload');
|
||||
Notification::make()->success()->title('Entwurf gespeichert')->body('Die Vorschau zeigt jetzt den Entwurf. Für alle sichtbar wird er erst mit „Veröffentlichen“.')->send();
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('publish')->label('Veröffentlichen')->icon(Heroicon::OutlinedRocketLaunch)
|
||||
->requiresConfirmation()
|
||||
->modalHeading('Erscheinungsbild veröffentlichen?')
|
||||
->modalDescription('Der gespeicherte Entwurf wird für alle sichtbar. Ungespeicherte Änderungen im Formular werden vorher als Entwurf gespeichert.')
|
||||
->action(function (Theme $theme, ThemeCompiler $compiler, Icons $icons, Branding $branding) {
|
||||
$theme->saveDraft($this->form->getState());
|
||||
$theme->publish($compiler, $icons);
|
||||
session()->forget(Branding::PREVIEW_SESSION_KEY);
|
||||
$branding->refresh();
|
||||
Audit::log('appearance.published');
|
||||
|
||||
$this->form->fill($theme->working());
|
||||
$this->dispatch('theme-preview-reload');
|
||||
Notification::make()->success()->title('Erscheinungsbild veröffentlicht')->send();
|
||||
}),
|
||||
Action::make('discard')->label('Entwurf verwerfen')->icon(Heroicon::OutlinedArrowUturnLeft)->color('gray')
|
||||
->visible(fn () => $this->hasDraft())
|
||||
->requiresConfirmation()
|
||||
->action(function (Theme $theme, Branding $branding) {
|
||||
$theme->discardDraft();
|
||||
session()->forget(Branding::PREVIEW_SESSION_KEY);
|
||||
$branding->refresh();
|
||||
$this->form->fill($theme->working());
|
||||
$this->dispatch('theme-preview-reload');
|
||||
}),
|
||||
ActionGroup::make([
|
||||
Action::make('export')->label('Exportieren')->icon(Heroicon::OutlinedArrowDownTray)
|
||||
->action(fn (ThemeTransfer $transfer): StreamedResponse => response()->streamDownload(
|
||||
fn () => print (json_encode($transfer->export(app(Theme::class)->working()), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)),
|
||||
'erscheinungsbild-'.now()->format('Y-m-d').'.json',
|
||||
['Content-Type' => 'application/json'],
|
||||
)),
|
||||
Action::make('import')->label('Importieren')->icon(Heroicon::OutlinedArrowUpTray)
|
||||
->modalDescription('Erscheinungsbild aus einer exportierten Datei übernehmen – als Entwurf, damit Sie es erst ansehen können.')
|
||||
->schema([
|
||||
FileUpload::make('file')->label('Datei (.json)')->disk('local')->directory('theme-import')
|
||||
->acceptedFileTypes(['application/json', 'text/plain'])->maxSize(20 * 1024)->required(),
|
||||
])
|
||||
->action(function (array $data, ThemeTransfer $transfer, Theme $theme) {
|
||||
try {
|
||||
$values = $transfer->import((string) Storage::disk('local')->get($data['file']));
|
||||
} catch (Throwable $e) {
|
||||
Notification::make()->danger()->title('Import nicht möglich')->body($e->getMessage())->send();
|
||||
|
||||
return;
|
||||
} finally {
|
||||
Storage::disk('local')->delete($data['file']);
|
||||
}
|
||||
|
||||
$theme->saveDraft($values);
|
||||
session()->put(Branding::PREVIEW_SESSION_KEY, true);
|
||||
$this->form->fill($theme->working());
|
||||
$this->dispatch('theme-preview-reload');
|
||||
Notification::make()->success()->title('Als Entwurf importiert')->send();
|
||||
}),
|
||||
Action::make('reset')->label('Auf Standard zurücksetzen')->icon(Heroicon::OutlinedArrowPath)->color('danger')
|
||||
->requiresConfirmation()
|
||||
->modalDescription('Setzt Farben, Schriften, Logos und Texte auf die Standardwerte zurück – als Entwurf. Der Portalname bleibt.')
|
||||
->action(function (Theme $theme) {
|
||||
$theme->resetToDefaults();
|
||||
session()->put(Branding::PREVIEW_SESSION_KEY, true);
|
||||
$this->form->fill($theme->working());
|
||||
$this->dispatch('theme-preview-reload');
|
||||
}),
|
||||
])->label('Mehr')->icon(Heroicon::OutlinedEllipsisVertical)->button()->color('gray'),
|
||||
];
|
||||
}
|
||||
}
|
||||
41
app/Filament/Pages/Appearance/AppearanceTypography.php
Normal file
41
app/Filament/Pages/Appearance/AppearanceTypography.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Appearance;
|
||||
|
||||
use App\Support\Theme\Fonts;
|
||||
use App\Support\Theme\Theme;
|
||||
use BackedEnum;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class AppearanceTypography extends AppearancePage
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedLanguage;
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
protected static ?string $navigationLabel = 'Schrift & Form';
|
||||
|
||||
protected static ?string $title = 'Schrift & Form';
|
||||
|
||||
protected static ?string $slug = 'schrift';
|
||||
|
||||
protected function fields(): array
|
||||
{
|
||||
return [
|
||||
Select::make('font_body')->label('Schrift')->options(fn (Get $get) => Fonts::options((bool) $get('custom_font')))->required()->native(false),
|
||||
Select::make('font_heading')->label('Schrift für Überschriften')->options(fn (Get $get) => ['same' => 'Wie die Schrift'] + Fonts::options((bool) $get('custom_font')))->required()->native(false),
|
||||
FileUpload::make('custom_font')->label('Eigene Schrift (WOFF2)')
|
||||
->helperText('Z. B. die Hausschrift aus dem Corporate Design. Wird lokal ausgeliefert – keine Verbindung zu Google oder anderen Diensten. Bitte die Lizenz für die Nutzung im Web beachten.')
|
||||
->disk('uploads')->directory('theme/fonts')->visibility('public')->maxSize(2048)
|
||||
->acceptedFileTypes(['font/woff2', 'application/font-woff2', 'application/octet-stream'])
|
||||
->rule('extensions:woff2')->live()->columnSpanFull(),
|
||||
Radio::make('radius')->label('Ecken')->options(collect(Theme::RADII)->map(fn ($r) => $r[0])->all())->inline()->required(),
|
||||
Radio::make('density')->label('Abstände')->options(collect(Theme::DENSITIES)->map(fn ($d) => $d[0])->all())->inline()->required(),
|
||||
Radio::make('dark_mode')->label('Dunkelmodus')->options(Theme::DARK_MODES)->required()->columnSpanFull(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue