Zeige Bibliothek und Anzeigefreigabe in der Bedienung
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
338739a882
commit
fc08e6d0f2
7 files changed
+60
-18
No files matched your search
@@ -3,6 +3,7 @@
|
||||
namespace App\Filament\Resources\Compositions\Pages;
|
||||
|
||||
use App\Domain\Catalog\Composition;
|
||||
use App\Domain\Catalog\CompositionDisplayRelease;
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Domain\Catalog\CompositionVersion;
|
||||
use App\Domain\Catalog\ContentElementVersion;
|
||||
@@ -79,6 +80,43 @@ public function form(Schema $schema): Schema
|
||||
]);
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('displayRelease')
|
||||
->label('Zur Anzeige freigeben')
|
||||
->requiresConfirmation()
|
||||
->visible(function (): bool {
|
||||
$version = $this->currentReadyVersion();
|
||||
|
||||
return $version !== null && ! app(CompositionDisplayRelease::class)->isReleased($version);
|
||||
})
|
||||
->action(function (): void {
|
||||
$version = $this->currentReadyVersion();
|
||||
$actor = Filament::auth()->user();
|
||||
abort_unless($version !== null && $actor instanceof User, 403);
|
||||
app(CompositionDisplayRelease::class)->release($version, $actor);
|
||||
Notification::make()->title('Die aktuelle Fassung ist zur Anzeige freigegeben.')->success()->send();
|
||||
}),
|
||||
Action::make('displayRevoke')
|
||||
->label('Anzeigefreigabe zurücknehmen')
|
||||
->color('danger')
|
||||
->requiresConfirmation()
|
||||
->visible(function (): bool {
|
||||
$version = $this->currentReadyVersion();
|
||||
|
||||
return $version !== null && app(CompositionDisplayRelease::class)->isReleased($version);
|
||||
})
|
||||
->action(function (): void {
|
||||
$version = $this->currentReadyVersion();
|
||||
$actor = Filament::auth()->user();
|
||||
abort_unless($version !== null && $actor instanceof User, 403);
|
||||
app(CompositionDisplayRelease::class)->revoke($version, $actor);
|
||||
Notification::make()->title('Die Anzeigefreigabe dieser Fassung ist zurückgenommen.')->success()->send();
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getSaveFormAction(): Action
|
||||
{
|
||||
return parent::getSaveFormAction()->label('Neue Fassung veröffentlichen');
|
||||
@@ -202,6 +240,17 @@ protected function getRedirectUrl(): ?string
|
||||
/**
|
||||
* @param list<array{role: string, target: ContentElementVersion|CompositionVersion}> $members
|
||||
*/
|
||||
private function currentReadyVersion(): ?CompositionVersion
|
||||
{
|
||||
/** @var Composition $composition */
|
||||
$composition = $this->getRecord();
|
||||
|
||||
return $composition->versions()
|
||||
->where('status', ContentVersionStatus::Bereit)
|
||||
->orderByDesc('number')
|
||||
->first();
|
||||
}
|
||||
|
||||
private function sameMembers(Composition $composition, array $members): bool
|
||||
{
|
||||
$version = $composition->versions()
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
@endif
|
||||
@if ($entries === [])
|
||||
<div class="empty">
|
||||
<p>Dieser Kurs hat noch keinen veröffentlichten Stand.</p>
|
||||
<p>Für diesen Eintrag liegt noch kein veröffentlichter Stand vor.</p>
|
||||
</div>
|
||||
@else
|
||||
<ol class="course">
|
||||
@@ -27,13 +27,7 @@
|
||||
<p>{{ implode(' · ', $entry['pillars']) }}</p>
|
||||
@endif
|
||||
@if ($entry['playable'])
|
||||
<video controls preload="metadata" playsinline src="{{ $entry['url'] }}" @if ($entry['decision'] !== null) data-decision="{{ $entry['decision'] }}" @endif></video>
|
||||
<p class="course-actions">
|
||||
@if ($entry['decision'] !== null)
|
||||
<button class="button" type="button" data-course-decision>Zur Entscheidungsmarke ({{ $entry['decision'] }} s)</button>
|
||||
@endif
|
||||
<button class="button" type="button" data-course-restart>Nochmal von vorn</button>
|
||||
</p>
|
||||
<video controls preload="metadata" playsinline src="{{ $entry['url'] }}"></video>
|
||||
@elseif ($entry['allowed'] && $entry['url'])
|
||||
<p><a href="{{ $entry['url'] }}">Ansehen</a></p>
|
||||
@else
|
||||
|
||||
@@ -5,5 +5,5 @@
|
||||
@section('content')
|
||||
@include('member.partials.nav')
|
||||
<h1>Guten Tag, {{ auth()->user()->name }}</h1>
|
||||
<p class="lede">Unter Kurse liegen die Übungen und Materialien Ihrer Berechtigungen. Angebote können Sie abrufen oder im Testmodus kaufen.</p>
|
||||
<p class="lede">In der Bibliothek liegen die Übungen und Materialien Ihrer Berechtigungen. Angebote können Sie abrufen oder im Testmodus kaufen.</p>
|
||||
@endsection
|
||||
@@ -1,15 +1,15 @@
|
||||
@extends('layouts.site')
|
||||
|
||||
@section('title', 'Kurse')
|
||||
@section('title', 'Bibliothek')
|
||||
|
||||
@section('content')
|
||||
@include('member.partials.nav')
|
||||
@inject('courses', App\Http\CourseOutline::class)
|
||||
<h1>Kurse</h1>
|
||||
<p class="lede">Jede Berechtigung öffnet einen Kurs oder ein einzelnes Material. Dieselben Bausteine können in mehreren Kursen und Paketen stecken.</p>
|
||||
<h1>Bibliothek</h1>
|
||||
<p class="lede">Jede Berechtigung öffnet ein Programm, ein Modul oder ein einzelnes Material.</p>
|
||||
@if ($grants->isEmpty())
|
||||
<div class="empty">
|
||||
<p>Noch kein Kurs. Unter Angebote können Sie ein kostenloses Material abrufen oder einen Kurs im Testmodus kaufen.</p>
|
||||
<p>Noch nichts in der Bibliothek. Unter Angebote können Sie ein kostenloses Material abrufen oder ein Angebot im Testmodus kaufen.</p>
|
||||
<p><a class="button" href="{{ route('member.offers') }}">Zu den Angeboten</a></p>
|
||||
</div>
|
||||
@else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<nav class="member-nav" aria-label="Mitgliederbereich">
|
||||
<a href="{{ route('member.dashboard') }}" @if(request()->routeIs('member.dashboard')) aria-current="page" @endif>Übersicht</a>
|
||||
<a href="{{ route('member.library') }}" @if(request()->routeIs('member.library', 'member.article')) aria-current="page" @endif>Kurse</a>
|
||||
<a href="{{ route('member.library') }}" @if(request()->routeIs('member.library', 'member.article')) aria-current="page" @endif>Bibliothek</a>
|
||||
<a href="{{ route('member.materials') }}" @if(request()->routeIs('member.materials')) aria-current="page" @endif>Filme und Materialien</a>
|
||||
<a href="{{ route('member.grants') }}" @if(request()->routeIs('member.grants')) aria-current="page" @endif>Berechtigungen</a>
|
||||
<a href="{{ route('member.offers') }}" @if(request()->routeIs('member.offers')) aria-current="page" @endif>Angebote</a>
|
||||
|
||||
@@ -45,7 +45,7 @@ public function test_a_course_is_shown_by_its_name_and_can_pause_at_the_decision
|
||||
$this->actingAs($member)
|
||||
->get(route('member.library'))
|
||||
->assertOk()
|
||||
->assertSee('Kurse')
|
||||
->assertSee('Bibliothek')
|
||||
->assertSee('Alltag üben');
|
||||
|
||||
$this->actingAs($member)
|
||||
@@ -53,8 +53,7 @@ public function test_a_course_is_shown_by_its_name_and_can_pause_at_the_decision
|
||||
->assertOk()
|
||||
->assertSee('Alltag üben')
|
||||
->assertSee('Erst ansehen, dann entscheiden.')
|
||||
->assertSee('Zur Entscheidungsmarke')
|
||||
->assertSee('data-decision="12"', false)
|
||||
->assertDontSee('Zur Entscheidungsmarke')
|
||||
->assertSee($article->code);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ public function test_verified_member_can_log_in_and_reaches_the_dashboard(): voi
|
||||
$response->assertRedirect(route('member.dashboard'));
|
||||
$this->assertAuthenticatedAs($user);
|
||||
$this->get('/bereich')->assertOk()->assertSee('Guten Tag');
|
||||
$this->get('/bereich/bibliothek')->assertOk()->assertSee('Noch kein Kurs');
|
||||
$this->get('/bereich/bibliothek')->assertOk()->assertSee('Noch nichts in der Bibliothek');
|
||||
}
|
||||
|
||||
public function test_unverified_member_cannot_open_the_member_area(): void
|
||||
|
||||
Reference in new issue
Block a user