Halte deaktivierte Bestandteile im Aufbau, damit die Freigabe sie anzeigt.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
d12ba67b45
commit
dd67741f35
7 files changed
+93
-26
No files matched your search
@@ -174,13 +174,13 @@ private function inspectElement(
|
||||
$kind = $this->outputLabel((string) $version->element->output_class);
|
||||
|
||||
if ($version->status === ContentVersionStatus::Bereit) {
|
||||
$ready[] = $this->line($title, $kind.' · '.$role.' · Fassung '.$version->number.', bleibt unverändert', $depth);
|
||||
$ready[] = $this->line($title, $this->kindAndRole($kind, $role).' · Fassung '.$version->number.', bleibt unverändert', $depth);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($version->status === ContentVersionStatus::Gesperrt) {
|
||||
$blocked[] = $this->block($title, $kind.' · '.$role.'. Diese Fassung ist deaktiviert und kann nicht freigegeben werden.', $depth, $edit);
|
||||
$blocked[] = $this->block($title, $this->kindAndRole($kind, $role).'. Diese Fassung ist deaktiviert und kann nicht freigegeben werden.', $depth, $edit);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -188,18 +188,18 @@ private function inspectElement(
|
||||
$problem = app(ContentService::class)->elementReleaseProblem($version);
|
||||
|
||||
if ($frozen) {
|
||||
$blocked[] = $this->block($title, $kind.' · '.$role.'. Eine bereits freigegebene Fassung verweist auf diesen Entwurf. Sie bleibt unverändert.', $depth, $edit);
|
||||
$blocked[] = $this->block($title, $this->kindAndRole($kind, $role).'. Eine bereits freigegebene Fassung verweist auf diesen Entwurf. Sie bleibt unverändert.', $depth, $edit);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($problem !== null) {
|
||||
$blocked[] = $this->block($title, $kind.' · '.$role.'. '.$problem, $depth, $edit);
|
||||
$blocked[] = $this->block($title, $this->kindAndRole($kind, $role).'. '.$problem, $depth, $edit);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$pending[] = $this->line($title, $kind.' · '.$role.'. Der Entwurf wird freigegeben. Es entsteht keine weitere Fassung.', $depth);
|
||||
$pending[] = $this->line($title, $this->kindAndRole($kind, $role).'. Der Entwurf wird freigegeben. Es entsteht keine weitere Fassung.', $depth);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -230,18 +230,18 @@ private function inspectReleasedComposition(
|
||||
$kind = $this->label($version->composition);
|
||||
|
||||
if (in_array($version->composition_id, $stack, true)) {
|
||||
$blocked[] = $this->block($title, $kind.' · '.$role.'. Der Aufbau verweist auf sich selbst. So kann nichts freigegeben werden.', $depth, ['type' => 'composition', 'id' => $version->composition_id]);
|
||||
$blocked[] = $this->block($title, $this->kindAndRole($kind, $role).'. Der Aufbau verweist auf sich selbst. So kann nichts freigegeben werden.', $depth, ['type' => 'composition', 'id' => $version->composition_id]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($version->status !== ContentVersionStatus::Bereit) {
|
||||
$blocked[] = $this->block($title, $kind.' · '.$role.'. Diese Fassung ist nicht freigegeben.', $depth, ['type' => 'composition', 'id' => $version->composition_id]);
|
||||
$blocked[] = $this->block($title, $this->kindAndRole($kind, $role).'. Diese Fassung ist nicht freigegeben.', $depth, ['type' => 'composition', 'id' => $version->composition_id]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$ready[] = $this->line($title, $kind.' · '.$role.' · Fassung '.$version->number.', bleibt unverändert', $depth);
|
||||
$ready[] = $this->line($title, $this->kindAndRole($kind, $role).' · Fassung '.$version->number.', bleibt unverändert', $depth);
|
||||
$nested = [];
|
||||
|
||||
foreach ($version->members()->orderBy('position')->get() as $member) {
|
||||
@@ -284,7 +284,7 @@ private function inspectDraftComposition(
|
||||
$kind = $this->label($composition);
|
||||
|
||||
if ($frozen || in_array($id, $stack, true)) {
|
||||
$blocked[] = $this->block($title, $kind.' · '.$role.'. Der Aufbau verweist auf sich selbst. So kann nichts freigegeben werden.', $depth, $edit);
|
||||
$blocked[] = $this->block($title, $this->kindAndRole($kind, $role).'. Der Aufbau verweist auf sich selbst. So kann nichts freigegeben werden.', $depth, $edit);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -293,7 +293,7 @@ private function inspectDraftComposition(
|
||||
$members = is_array($draft['members'] ?? null) ? $draft['members'] : [];
|
||||
|
||||
if ($members === []) {
|
||||
$blocked[] = $this->block($title, $kind.' · '.$role.'. Der gespeicherte Entwurf hat keinen Bestandteil.', $depth, $edit);
|
||||
$blocked[] = $this->block($title, $this->kindAndRole($kind, $role).'. Der gespeicherte Entwurf hat keinen Bestandteil.', $depth, $edit);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -301,14 +301,14 @@ private function inspectDraftComposition(
|
||||
$minutes = $draft['duration_minutes'] ?? null;
|
||||
|
||||
if ($minutes !== null && $minutes !== '' && ! is_int($minutes)) {
|
||||
$blocked[] = $this->block($title, $kind.' · '.$role.'. Der Zeitbedarf ist keine Zahl von Minuten.', $depth, $edit);
|
||||
$blocked[] = $this->block($title, $this->kindAndRole($kind, $role).'. Der Zeitbedarf ist keine Zahl von Minuten.', $depth, $edit);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$nestedDraft = true;
|
||||
$number = ((int) $composition->versions()->max('number')) + 1;
|
||||
$pending[] = $this->line($title, $kind.' · '.$role.'. Es entsteht Fassung '.$number.'.', $depth);
|
||||
$pending[] = $this->line($title, $this->kindAndRole($kind, $role).'. Es entsteht Fassung '.$number.'.', $depth);
|
||||
$this->inspectMembers($members, $depth + 1, [...$stack, $id], false, $ready, $pending, $blocked, $nestedDraft);
|
||||
}
|
||||
|
||||
@@ -442,6 +442,17 @@ private function block(string $title, string $detail, int $depth, ?array $edit):
|
||||
return ['title' => $title, 'detail' => $detail, 'depth' => $depth, 'edit' => $edit];
|
||||
}
|
||||
|
||||
private function kindAndRole(string $kind, string $role): string
|
||||
{
|
||||
$role = trim($role);
|
||||
|
||||
if ($role === '' || mb_strtolower($role) === mb_strtolower($kind)) {
|
||||
return $kind;
|
||||
}
|
||||
|
||||
return $kind.' · '.$role;
|
||||
}
|
||||
|
||||
private function title(Composition $composition): string
|
||||
{
|
||||
return filled($composition->display_title) ? (string) $composition->display_title : (string) $composition->designation;
|
||||
|
||||
@@ -676,7 +676,7 @@ public function childrenOf(string $target): string
|
||||
continue;
|
||||
}
|
||||
|
||||
$row = app(EditorialCatalog::class)->rowForTarget((string) ($member['target'] ?? ''), (int) $this->getRecord()->getKey(), allowSelf: true, allowDraft: true);
|
||||
$row = app(EditorialCatalog::class)->rowForTarget((string) ($member['target'] ?? ''), (int) $this->getRecord()->getKey(), allowSelf: true, allowDraft: true, allowBlocked: true);
|
||||
$lines[] = trim((string) ($member['role'] ?? '')).': '.($row['title'] ?? 'Bestandteil');
|
||||
}
|
||||
|
||||
@@ -1622,7 +1622,7 @@ protected function applyDraft(array $draft): void
|
||||
}
|
||||
|
||||
$requested++;
|
||||
$row = $catalog->rowForTarget((string) ($member['target'] ?? ''), (int) $this->getRecord()->getKey(), allowSelf: true, allowDraft: true);
|
||||
$row = $catalog->rowForTarget((string) ($member['target'] ?? ''), (int) $this->getRecord()->getKey(), allowSelf: true, allowDraft: true, allowBlocked: true);
|
||||
|
||||
if ($row === null) {
|
||||
continue;
|
||||
|
||||
@@ -281,11 +281,22 @@ protected function getHeaderActions(): array
|
||||
->modalHeading('Fassung freigeben')
|
||||
->modalDescription('Diese Fassung wird freigegeben. Sie erscheint dadurch nicht in der Mitgliederbibliothek, nicht auf der Website und nicht in einem Angebot. Eine deaktivierte Fassung bleibt unverändert.')
|
||||
->modalSubmitActionLabel('Freigeben')
|
||||
->visible(fn (): bool => ContentElementResource::editor())
|
||||
->visible(function (): bool {
|
||||
/** @var ContentElement $element */
|
||||
$element = $this->getRecord();
|
||||
|
||||
return ContentElementResource::editor()
|
||||
&& $element->versions()->where('status', ContentVersionStatus::Entwurf)->exists();
|
||||
})
|
||||
->action(function (array $arguments): void {
|
||||
abort_unless(ContentElementResource::editor(), 403);
|
||||
$this->report(function () use ($arguments): string {
|
||||
$version = $this->ownedVersion((int) ($arguments['version'] ?? 0));
|
||||
/** @var ContentElement $element */
|
||||
$element = $this->getRecord();
|
||||
$versionId = (int) ($arguments['version'] ?? 0);
|
||||
$version = $versionId > 0
|
||||
? $this->ownedVersion($versionId)
|
||||
: $element->versions()->where('status', ContentVersionStatus::Entwurf)->orderByDesc('number')->first();
|
||||
abort_unless($version instanceof ContentElementVersion, 404);
|
||||
$released = app(ContentService::class)->releaseElementVersion($version);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public function rows(CompositionVersion $version, int $exceptCompositionId): arr
|
||||
$target = $member->content_element_version_id
|
||||
? 'element:'.$member->content_element_version_id
|
||||
: 'composition:'.$member->nested_composition_version_id;
|
||||
$row = $this->rowForTarget($target, $exceptCompositionId, allowSelf: true, allowDraft: true);
|
||||
$row = $this->rowForTarget($target, $exceptCompositionId, allowSelf: true, allowDraft: true, allowBlocked: true);
|
||||
|
||||
if ($row === null) {
|
||||
continue;
|
||||
@@ -57,7 +57,7 @@ public function rows(CompositionVersion $version, int $exceptCompositionId): arr
|
||||
/**
|
||||
* @return array<string, string|null>|null
|
||||
*/
|
||||
public function rowForTarget(string $target, int $exceptCompositionId, bool $allowSelf = false, bool $allowDraft = false): ?array
|
||||
public function rowForTarget(string $target, int $exceptCompositionId, bool $allowSelf = false, bool $allowDraft = false, bool $allowBlocked = false): ?array
|
||||
{
|
||||
if (preg_match('/^composition-draft:(\d+)$/', $target, $draftMatch) === 1) {
|
||||
return $this->draftCompositionRow((int) $draftMatch[1], $exceptCompositionId, $allowSelf);
|
||||
@@ -77,6 +77,10 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
|
||||
$acceptable[] = ContentVersionStatus::Entwurf;
|
||||
}
|
||||
|
||||
if ($allowBlocked) {
|
||||
$acceptable[] = ContentVersionStatus::Gesperrt;
|
||||
}
|
||||
|
||||
if (! $version instanceof ContentElementVersion || ! in_array($version->status, $acceptable, true)) {
|
||||
return null;
|
||||
}
|
||||
@@ -98,7 +102,11 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
|
||||
'license_note' => (string) ($element->license_note ?? ''),
|
||||
'tone' => $this->tone((string) $element->output_class, $kind),
|
||||
'image' => $this->cardUrl('element', $element->id, $element->thumbnail_path),
|
||||
'version_label' => $version->status === ContentVersionStatus::Entwurf ? 'Entwurf' : 'Fassung '.$version->number,
|
||||
'version_label' => match ($version->status) {
|
||||
ContentVersionStatus::Entwurf => 'Entwurf',
|
||||
ContentVersionStatus::Gesperrt => 'deaktiviert',
|
||||
default => 'Fassung '.$version->number,
|
||||
},
|
||||
'committed' => app(ContentService::class)->isCommitted($version),
|
||||
'identity' => 'medium:'.$element->id,
|
||||
'open_url' => route('content.preview', $version),
|
||||
@@ -111,7 +119,13 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
|
||||
->with('composition.editorialContentKind')
|
||||
->find($match[2]);
|
||||
|
||||
if (! $version instanceof CompositionVersion || $version->status !== ContentVersionStatus::Bereit) {
|
||||
$acceptable = [ContentVersionStatus::Bereit];
|
||||
|
||||
if ($allowBlocked) {
|
||||
$acceptable[] = ContentVersionStatus::Gesperrt;
|
||||
}
|
||||
|
||||
if (! $version instanceof CompositionVersion || ! in_array($version->status, $acceptable, true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -130,7 +144,9 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
|
||||
'summary' => (string) ($composition->summary ?? ''),
|
||||
'tone' => $this->tone('', $kind),
|
||||
'image' => $this->cardUrl('komposition', $composition->id, $composition->thumbnail_path),
|
||||
'version_label' => 'Fassung '.$version->number,
|
||||
'version_label' => $version->status === ContentVersionStatus::Gesperrt
|
||||
? 'deaktiviert'
|
||||
: 'Fassung '.$version->number,
|
||||
'identity' => 'zusammenstellung:'.$composition->id,
|
||||
'open_url' => route('editorial.preview', ['composition' => $composition, 'version' => $version]),
|
||||
'open_label' => 'Aufbau ansehen',
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<p class="luf-return">
|
||||
Dieser Eintrag wurde aus einem anderen Aufbau geöffnet.
|
||||
<button type="button" class="luf-primary" wire:click="returnAndInclude">
|
||||
{{ $this->includeNeedsRelease() ? 'Freigeben und einbinden' : 'Zurück und einbinden' }}
|
||||
{{ $this->includeNeedsRelease() ? 'Fassung freigeben und einbinden' : 'Zurück und einbinden' }}
|
||||
</button>
|
||||
</p>
|
||||
@endif
|
||||
@@ -218,7 +218,7 @@
|
||||
|
||||
<h3>Freigegebene Fassungen</h3>
|
||||
@if ($this->versionChoices() === [])
|
||||
<p class="luf-empty">Noch keine freigegebene Fassung. Sie entsteht mit „Freigeben“, nicht beim Speichern des Entwurfs.</p>
|
||||
<p class="luf-empty">Noch keine freigegebene Fassung. Sie entsteht mit „Fassung freigeben“, nicht beim Speichern des Entwurfs.</p>
|
||||
@else
|
||||
<ul class="luf-list">
|
||||
@foreach ($this->versionChoices() as $version)
|
||||
@@ -257,7 +257,7 @@
|
||||
<summary>Was Speichern und Freigeben bedeuten</summary>
|
||||
<p>Titel, Kurzbeschreibung, fachliche Beschreibung, Einordnung und Titelbild ändern die sichtbare Karte. Sie erzeugen keine Inhaltsfassung.</p>
|
||||
<p>Entwurf speichern hält Aufbau, Rollen, Lernziel, Zeit und Material fest. Das kann beliebig oft geschehen. Eine freigegebene Fassung bleibt dabei unverändert.</p>
|
||||
<p>Freigeben erzeugt eine neue unveränderliche Fassung. Die bisherige bleibt für ältere Verweise erhalten.</p>
|
||||
<p>„Fassung freigeben“ erzeugt eine neue unveränderliche Fassung. Die bisherige bleibt für ältere Verweise erhalten.</p>
|
||||
<p>In Mitgliederbibliothek anzeigen entscheidet, welche freigegebene Fassung Trainer sehen. Das veröffentlicht weder die Website noch ein Angebot.</p>
|
||||
<p>Ein Medium oder Modul, das auch woanders steckt, bleibt dort bei seiner bisherigen Fassung. Hier wird nur darauf verwiesen.</p>
|
||||
</details>
|
||||
@@ -300,7 +300,7 @@
|
||||
<textarea id="beschreibung" rows="8" wire:model="description"></textarea>
|
||||
</div>
|
||||
@elseif ($this->moduleTab === 'didaktik')
|
||||
<p class="luf-note">Lernziel, Zeit und Material gehören zum fachlichen Stand. Sie landen im Entwurf und erzeugen erst mit Freigeben eine neue Fassung.</p>
|
||||
<p class="luf-note">Lernziel, Zeit und Material gehören zum fachlichen Stand. Sie landen im Entwurf und erzeugen erst mit „Fassung freigeben“ eine neue Fassung.</p>
|
||||
<div class="luf-field">
|
||||
<label for="lernziel">Lernziel</label>
|
||||
<textarea id="lernziel" rows="4" wire:model="learningGoal"></textarea>
|
||||
@@ -578,7 +578,11 @@
|
||||
@else
|
||||
<p class="luf-note">Das ist der aktuelle Stand. Eine weitere zulässige Fassung liegt nicht vor.</p>
|
||||
@endif
|
||||
<p class="luf-note">Übernehmen verweist auf diese vorhandene Fassung. Es wird nichts kopiert und keine neue Fassung des Eintrags angelegt.</p>
|
||||
@if (($detail['version_label'] ?? '') === 'Entwurf')
|
||||
<p class="luf-note">Übernehmen nimmt diesen Entwurf in den Aufbau. Eine Fassung entsteht erst, wenn du das Modul oder Programm freigibst und die gemeinsame Freigabe bestätigst.</p>
|
||||
@else
|
||||
<p class="luf-note">Übernehmen verweist auf diese vorhandene Fassung. Es wird nichts kopiert und keine neue Fassung des Eintrags angelegt.</p>
|
||||
@endif
|
||||
<div class="luf-actions">
|
||||
@if ($detail['open_url'])
|
||||
<a class="luf-link" href="{{ $detail['open_url'] }}" target="_blank" rel="noopener">Ansehen</a>
|
||||
|
||||
@@ -779,6 +779,8 @@ public function test_release_reviews_the_structure_and_keeps_other_references():
|
||||
->test(EditCourse::class, ['record' => $program->id])
|
||||
->call('openPicker')
|
||||
->assertSee('Untermodul')
|
||||
->set('pickerSelected', 'composition-draft:'.$child->id)
|
||||
->assertSee('gemeinsame Freigabe')
|
||||
->call('addPart', 'composition-draft:'.$child->id)
|
||||
->call('armRelease')
|
||||
->assertSee('Es entsteht Fassung 1')
|
||||
@@ -793,6 +795,9 @@ public function test_release_reviews_the_structure_and_keeps_other_references():
|
||||
$this->assertSame(1, $other->composition->fresh()->versions()->count());
|
||||
$this->assertSame($film->id, $other->fresh()->members()->first()->content_element_version_id);
|
||||
|
||||
$held = $content->createComposition('Behält den Hinweis', CompositionKind::Uebung);
|
||||
$content->publishComposition($held, [['role' => 'Hinweis', 'target' => $soonBlocked]]);
|
||||
|
||||
$broken = $content->createComposition('Mit Fehler', CompositionKind::Uebung);
|
||||
$brokenEditor = Livewire::actingAs($editor, 'staff')
|
||||
->test(EditExercise::class, ['record' => $broken->id])
|
||||
@@ -807,6 +812,20 @@ public function test_release_reviews_the_structure_and_keeps_other_references():
|
||||
|
||||
$this->assertSame(0, $broken->fresh()->versions()->count());
|
||||
$this->assertSame(ContentVersionStatus::Gesperrt, $soonBlocked->fresh()->status);
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditExercise::class, ['record' => $broken->id])
|
||||
->assertSee('Alter Hinweis')
|
||||
->assertSee('deaktiviert');
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditExercise::class, ['record' => $held->id])
|
||||
->assertSee('Alter Hinweis')
|
||||
->assertSee('deaktiviert')
|
||||
->set('learningGoal', 'Der Hinweis bleibt sichtbar')
|
||||
->call('armRelease')
|
||||
->assertSee('Diese Fassung ist deaktiviert')
|
||||
->assertSee('content-elements/'.$soonBlocked->content_element_id);
|
||||
$this->assertSame(1, $other->composition->fresh()->versions()->count());
|
||||
}
|
||||
|
||||
|
||||
@@ -488,5 +488,11 @@ public function test_a_draft_medium_can_be_released_from_its_editor(): void
|
||||
|
||||
$this->assertSame(ContentVersionStatus::Bereit, $version->fresh()->status);
|
||||
$this->assertSame(1, $version->element->fresh()->versions()->count());
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(ViewContentElement::class, ['record' => $version->content_element_id])
|
||||
->assertSee('freigegeben')
|
||||
->assertDontSee('Fassung freigeben');
|
||||
$this->assertSame(1, $version->element->fresh()->versions()->count());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user