Führe den gemeinsamen Redaktionsarbeitsplatz ein.
Deploy Test / test (push) Successful in 55s
Deploy Test / deploy (push) Successful in 24s

Texte, Medienzuordnung und Einordnung teilen sich einen Arbeitsplatz. Fassungen, Rechte und das Datenmodell bleiben unverändert.
This commit is contained in:
Lars committed 2026-11-19 14:43:15 +01:00
1 parent a359a5fb69
commit 4c29ab2593
140 files changed
+6705 -201

No files matched your search

@@ -8,6 +8,7 @@
use App\Domain\Catalog\EditorialProfile;
use App\Domain\Catalog\EditorialProfileReader;
use App\Domain\Catalog\EditorialTextVariant;
use App\Domain\Catalog\PresentationAssignment;
use App\Domain\Catalog\PresentationMedia;
use App\Domain\Catalog\PresentationRole;
use App\Domain\Media\WebsiteRelease;
@@ -27,8 +28,16 @@ trait ManagesEditorialSurface
public string $presentationPick = '';
public string $presentationInspect = '';
public bool $bindToVersion = false;
public bool $redaktionOpen = false;
public string $redaktionTab = 'texte';
public ?int $replacingAssignment = null;
public string $deskFeedback = '';
public string $variantAudience = 'kachel';
@@ -106,6 +115,97 @@ public function assignPickedPresentation(): void
$this->rememberAssignment((int) $row['element_id'], isset($row['target']) ? (string) $row['target'] : null);
$this->presentationPick = '';
$this->presentationInspect = '';
}
public function openRedaktion(): void
{
$this->guardEditorial();
$this->redaktionOpen = true;
$this->redaktionTab = 'texte';
}
public function closeRedaktion(): void
{
$this->redaktionOpen = false;
$this->presentationInspect = '';
$this->replacingAssignment = null;
}
public function cancelPresentationPick(): void
{
$this->presentationPick = '';
$this->presentationInspect = '';
$this->replacingAssignment = null;
$this->deskFeedback = 'Die vorhandene Zuordnung bleibt unverändert.';
}
public function beginExchange(int $assignmentId): void
{
$this->guardEditorial();
foreach ($this->presentationRows() as $row) {
if ((int) $row['id'] !== $assignmentId) {
continue;
}
$this->presentationRole = (string) $row['role'];
$this->replacingAssignment = $assignmentId;
$this->presentationPick = '';
$this->presentationInspect = '';
$this->redaktionTab = 'medien';
$this->deskFeedback = 'Wähle das neue Medium und übernimm es. Abbrechen lässt die bisherige Zuordnung stehen.';
if (method_exists($this, 'openPresentationPicker')) {
$this->openPresentationPicker();
}
return;
}
$this->deskFeedback = 'Diese Zuordnung gibt es nicht mehr.';
}
public function placePresentation(int $assignmentId, int $beforeId): void
{
$this->guardEditorial();
$rows = $this->presentationRows();
$moving = null;
foreach ($rows as $row) {
if ((int) $row['id'] === $assignmentId) {
$moving = $row;
}
}
if ($moving === null || ! $moving['ordered']) {
$this->deskFeedback = 'Diese Rolle hat eine feste einzelne Zuordnung und wird nicht umsortiert.';
return;
}
$ids = [];
foreach ($rows as $row) {
if ($row['role'] === $moving['role']) {
$ids[] = (int) $row['id'];
}
}
$from = array_search($assignmentId, $ids, true);
$to = array_search($beforeId, $ids, true);
if ($from === false || $to === false || $from === $to) {
return;
}
$direction = $to < $from ? -1 : 1;
for ($step = 0; $step < abs($to - $from); $step++) {
app(PresentationMedia::class)->move($this->editorialSubject(), $assignmentId, $direction, $this->deskActor());
}
$this->deskFeedback = 'Die Reihenfolge gilt nur in dieser Rolle.';
}
public function detachPresentation(int $assignmentId): void
@@ -245,6 +345,36 @@ protected function rememberAssignment(int $elementId, ?string $target): void
$this->deskActor(),
),
);
$this->finishExchange();
}
protected function finishExchange(): void
{
$previous = $this->replacingAssignment;
if ($previous === null || ! str_contains($this->deskFeedback, 'zugeordnet')) {
return;
}
$this->replacingAssignment = null;
$still = PresentationAssignment::query()->find($previous);
if (! $still instanceof PresentationAssignment) {
$this->deskFeedback = 'Die Zuordnung ist ausgetauscht. '.$this->deskFeedback;
return;
}
if (str_contains($this->deskFeedback, 'bereits')) {
return;
}
$removed = $this->reportPresentation(
fn (): string => app(PresentationMedia::class)->detach($this->editorialSubject(), $previous, $this->deskActor()),
);
$this->deskFeedback = str_contains($removed, 'entfernt')
? 'Die bisherige Zuordnung ist ersetzt. '.$this->deskFeedback
: $removed;
}
protected function versionIdFromTarget(?string $target): ?int