Halte Aufklappen an der Quelle fest und nenne die in der Bibliothek sichtbare Fassung richtig.
Aufgeklappte Module bleiben beim Verschieben aufgeklappt. Der Hinweis zur Mitgliederbibliothek widersprach den Fassungsangaben, wenn eine ältere Fassung sichtbar war. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7eb3cd6230
commit
105d27f9c9
3 files changed
+55
-9
No files matched your search
@@ -127,7 +127,7 @@ abstract class EditComposition extends EditRecord
|
||||
/** Ansicht der ausgewählten Verwendung: stelle, quelle oder vorschau. */
|
||||
public string $detailTab = 'stelle';
|
||||
|
||||
/** @var list<int> aufgeklappte Bestandteile mit Quelleninhalt */
|
||||
/** @var list<string> aufgeklappte Bestandteile (Ziel der Verwendung), unabhängig von ihrer Position */
|
||||
public array $expanded = [];
|
||||
|
||||
public string $imageMode = 'film';
|
||||
@@ -555,9 +555,13 @@ public function releaseFollowUp(): string
|
||||
|
||||
/** @var Composition $composition */
|
||||
$composition = $this->getRecord();
|
||||
$library = app(CompositionDisplayRelease::class)->isReleased($version)
|
||||
? 'In der Mitgliederbibliothek ist Fassung '.$version->number.' sichtbar.'
|
||||
: 'In der Mitgliederbibliothek ist noch keine Fassung sichtbar. „In Mitgliederbibliothek anzeigen“ wählt die letzte freigegebene Fassung. Das veröffentlicht weder die Website noch ein Angebot.';
|
||||
$releases = app(CompositionDisplayRelease::class);
|
||||
$shown = $releases->highestReleasedVersion($composition);
|
||||
$library = match (true) {
|
||||
$releases->isReleased($version) => 'In der Mitgliederbibliothek ist Fassung '.$version->number.' sichtbar.',
|
||||
$shown !== null => 'In der Mitgliederbibliothek ist Fassung '.$shown->number.' sichtbar, die neuere Fassung '.$version->number.' noch nicht. „In Mitgliederbibliothek anzeigen“ zeigt Fassung '.$version->number.'. Das veröffentlicht weder die Website noch ein Angebot.',
|
||||
default => 'In der Mitgliederbibliothek ist noch keine Fassung sichtbar. „In Mitgliederbibliothek anzeigen“ wählt die letzte freigegebene Fassung. Das veröffentlicht weder die Website noch ein Angebot.',
|
||||
};
|
||||
$draft = is_array($composition->working_draft) && $composition->working_draft !== []
|
||||
? ' Es gibt einen gespeicherten Entwurf neben der freigegebenen Fassung.'
|
||||
: ' Es gibt keinen offenen Entwurf. Änderungen hältst du mit „Entwurf speichern“ fest.';
|
||||
@@ -822,9 +826,15 @@ public function openPart(int $index): void
|
||||
|
||||
public function toggleExpanded(int $index): void
|
||||
{
|
||||
$this->expanded = in_array($index, $this->expanded, true)
|
||||
? array_values(array_diff($this->expanded, [$index]))
|
||||
: [...$this->expanded, $index];
|
||||
$target = (string) ($this->members[$index]['target'] ?? '');
|
||||
|
||||
if ($target === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->expanded = in_array($target, $this->expanded, true)
|
||||
? array_values(array_diff($this->expanded, [$target]))
|
||||
: [...$this->expanded, $target];
|
||||
}
|
||||
|
||||
public function showAufbauTab(string $tab): void
|
||||
@@ -962,7 +972,6 @@ public function removePart(int $index): void
|
||||
$title = (string) ($this->members[$index]['title'] ?? 'Der Bestandteil');
|
||||
unset($this->members[$index]);
|
||||
$this->members = array_values($this->members);
|
||||
$this->expanded = [];
|
||||
$this->selected = $this->members === [] ? null : min($index, count($this->members) - 1);
|
||||
$this->syncRoleDraft();
|
||||
$this->feedback = '„'.$title.'“ ist aus diesem Aufbau genommen. Das Quellobjekt bleibt im Bestand. Gespeichert ist das erst mit „Entwurf speichern“; eine freigegebene Fassung bleibt unverändert.';
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
@foreach ($members as $index => $member)
|
||||
@php
|
||||
$aktiv = $auswahl === $index;
|
||||
$offen = in_array($index, $this->expanded, true);
|
||||
$offen = in_array((string) $member['target'], $this->expanded, true);
|
||||
$komposition = $istKomposition($member);
|
||||
@endphp
|
||||
<li wire:key="baustein-{{ $member['target'] }}-{{ $index }}"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Domain\Catalog\ArticleService;
|
||||
use App\Domain\Catalog\CompositionDisplayRelease;
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Catalog\ContentService;
|
||||
@@ -225,6 +226,42 @@ public function test_a_referenced_module_shows_its_source_content_read_only(): v
|
||||
->assertSee('Quelle bearbeiten');
|
||||
}
|
||||
|
||||
public function test_the_library_note_names_the_version_members_actually_see(): void
|
||||
{
|
||||
$content = app(ContentService::class);
|
||||
$sheet = $content->publishElementVersion($content->createElement('text', 'text', 'Blatt'), 'A');
|
||||
$other = $content->publishElementVersion($content->createElement('text', 'text', 'Blatt zwei'), 'B');
|
||||
$module = $content->createComposition('Sichtbar', CompositionKind::Uebung);
|
||||
$first = $content->publishComposition($module, [['role' => 'Unterlage', 'target' => $sheet]]);
|
||||
$editor = $this->editor();
|
||||
app(CompositionDisplayRelease::class)->release($first, $editor);
|
||||
$content->publishComposition($module->fresh(), [['role' => 'Unterlage', 'target' => $other]]);
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditExercise::class, ['record' => $module->id])
|
||||
->call('showAufbauTab', 'verlauf')
|
||||
->assertSee('In der Mitgliederbibliothek ist Fassung 1 sichtbar, die neuere Fassung 2 noch nicht.')
|
||||
->assertDontSee('noch keine Fassung sichtbar');
|
||||
}
|
||||
|
||||
public function test_an_expanded_module_stays_expanded_when_it_moves(): void
|
||||
{
|
||||
$content = app(ContentService::class);
|
||||
$sheet = $content->publishElementVersion($content->createElement('text', 'text', 'Unterlage A'), 'A');
|
||||
$other = $content->publishElementVersion($content->createElement('text', 'text', 'Unterlage B'), 'B');
|
||||
$first = $content->publishComposition($content->createComposition('Erstes Modul', CompositionKind::Uebung), [['role' => 'Unterlage', 'target' => $sheet]]);
|
||||
$second = $content->publishComposition($content->createComposition('Zweites Modul', CompositionKind::Uebung), [['role' => 'Unterlage', 'target' => $other]]);
|
||||
$program = $content->publishComposition($content->createComposition('Programm', CompositionKind::Kurs), [['role' => 'Modul', 'target' => $first], ['role' => 'Modul', 'target' => $second]]);
|
||||
|
||||
Livewire::actingAs($this->editor(), 'staff')
|
||||
->test(EditCourse::class, ['record' => $program->composition_id])
|
||||
->call('toggleExpanded', 0)
|
||||
->assertSee('Unterlage A')
|
||||
->call('movePart', 0, 1)
|
||||
->assertSee('Unterlage A')
|
||||
->assertDontSee('Unterlage B');
|
||||
}
|
||||
|
||||
public function test_creating_a_medium_from_the_picker_closes_the_picker_first(): void
|
||||
{
|
||||
$module = app(ContentService::class)->createComposition('Neues Medium', CompositionKind::Uebung);
|
||||
|
||||
Reference in new issue
Block a user