Zeige Medienfassungen in der Verwaltung und halte Beschreibungen davon getrennt.
Eine Fassung bleibt nummeriert und kann deaktiviert werden. Beschreibung und fachliche Säulen gehören zum Medium und legen keine neue Fassung an. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
12f12117dd
commit
af85a94cd5
28 files changed
+1002
-168
No files matched your search
@@ -7,6 +7,7 @@
|
||||
use App\Filament\Resources\Combinations\CombinationResource;
|
||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||
use App\Filament\Resources\ContentElements\Pages\EditContentElement;
|
||||
use App\Filament\Resources\ContentElements\Pages\ViewContentElement;
|
||||
use App\Filament\Resources\Courses\CourseResource;
|
||||
use App\Filament\Resources\Exercises\ExerciseResource;
|
||||
use App\Filament\Resources\Exercises\Pages\EditExercise;
|
||||
@@ -39,15 +40,14 @@ public function test_a_medium_keeps_the_old_version_when_a_new_one_is_saved(): v
|
||||
$editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
|
||||
$this->actingAs($editor, 'staff');
|
||||
|
||||
Livewire::test(EditContentElement::class, ['record' => $element->getKey()])
|
||||
Livewire::test(ViewContentElement::class, ['record' => $element->getKey()])
|
||||
->assertOk()
|
||||
->assertSee('Erste Fassung')
|
||||
->fillForm([
|
||||
'working_title' => 'Merkblatt',
|
||||
->assertSee('Fassung 1')
|
||||
->callAction('revise', [
|
||||
'body' => 'Zweite Fassung',
|
||||
'change_note' => 'Korrektur',
|
||||
])
|
||||
->call('save')
|
||||
->assertHasNoFormErrors();
|
||||
|
||||
$versions = $element->versions()->orderBy('number')->get();
|
||||
@@ -69,14 +69,13 @@ public function test_an_uploaded_file_becomes_a_ready_version(): void
|
||||
$editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
|
||||
$this->actingAs($editor, 'staff');
|
||||
|
||||
Livewire::test(EditContentElement::class, ['record' => $element->getKey()])
|
||||
->fillForm([
|
||||
Livewire::test(ViewContentElement::class, ['record' => $element->getKey()])
|
||||
->callAction('revise', [
|
||||
'working_title' => 'Übungsfilm',
|
||||
'body' => 'Anleitung zum Film',
|
||||
'incoming' => ['inhalte/film.mp4'],
|
||||
'decision_seconds' => 12,
|
||||
])
|
||||
->call('save')
|
||||
->assertHasNoFormErrors();
|
||||
|
||||
$version = $element->versions()->first();
|
||||
@@ -150,5 +149,58 @@ public function test_a_catalog_keeper_cannot_edit_media(): void
|
||||
$this->actingAs($keeper, 'staff')
|
||||
->get(ContentElementResource::getUrl('edit', ['record' => $element]))
|
||||
->assertForbidden();
|
||||
|
||||
$version = app(ContentService::class)->publishElementVersion($element, 'Sichtbarer Text');
|
||||
|
||||
$this->actingAs($keeper, 'staff')
|
||||
->get(ContentElementResource::getUrl('view', ['record' => $element]))
|
||||
->assertOk()
|
||||
->assertSee('Fassung 1')
|
||||
->assertSee('Sichtbarer Text')
|
||||
->assertDontSee('Beschreibung ändern');
|
||||
}
|
||||
|
||||
public function test_a_description_does_not_create_a_version_and_an_older_version_can_be_deactivated(): void
|
||||
{
|
||||
Storage::fake('media_derived');
|
||||
Storage::disk('media_derived')->put('inhalte/film.mp4', 'filmbytes');
|
||||
$content = app(ContentService::class);
|
||||
$element = $content->createElement('film', 'film', 'Übungsfilm');
|
||||
$first = $content->publishElementVersion($element, 'Erste Fassung', ['file' => 'inhalte/film.mp4']);
|
||||
$second = $content->publishElementVersion($element, 'Zweite Fassung', ['file' => 'inhalte/film.mp4']);
|
||||
$editor = User::factory()->redakteur()->create();
|
||||
$editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
|
||||
$this->actingAs($editor, 'staff');
|
||||
|
||||
Livewire::test(EditContentElement::class, ['record' => $element->getKey()])
|
||||
->fillForm([
|
||||
'working_title' => 'Übungsfilm',
|
||||
'description' => 'Für die Gruppe',
|
||||
'pillars' => [],
|
||||
])
|
||||
->call('save')
|
||||
->assertHasNoFormErrors();
|
||||
|
||||
$this->assertSame(2, $element->versions()->count());
|
||||
$this->assertSame('Für die Gruppe', $element->fresh()->description);
|
||||
|
||||
Livewire::test(ViewContentElement::class, ['record' => $element->getKey()])
|
||||
->assertSee('Fassung 1')
|
||||
->assertSee('Fassung 2')
|
||||
->assertSee('<video', false)
|
||||
->assertSee(route('content.file', $second), false)
|
||||
->callAction('deactivate', ['reason' => 'Veraltet'], ['version' => $first->id])
|
||||
->assertHasNoFormErrors()
|
||||
->assertSee('deaktiviert');
|
||||
|
||||
$first->refresh();
|
||||
|
||||
$this->assertSame(ContentVersionStatus::Gesperrt, $first->status);
|
||||
$this->assertSame('Veraltet', $first->block_reason);
|
||||
$this->assertSame(ContentVersionStatus::Bereit, $element->versions()->where('number', 2)->first()->status);
|
||||
|
||||
$this->actingAs($editor, 'staff')
|
||||
->get(route('content.file', $first))
|
||||
->assertOk();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user