Pflege Anzeigedaten ohne neue Fassung und zeige sie in den echten Karten.
Der Medieneditor trennt Beschreibung, Inhalt, Fassungen und Verwendung. Der vorhandene Picker filtert nach Zusammenhang und lässt Entwürfe für die gemeinsame Freigabe sichtbar. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3e56314cf9
commit
d37a7093dd
13 files changed
+827
-54
No files matched your search
@@ -16,7 +16,9 @@
|
||||
use App\Domain\Catalog\IdentityDimensionValue;
|
||||
use App\Domain\Catalog\LicenseArticle;
|
||||
use App\Domain\Catalog\OfferStatus;
|
||||
use App\Domain\Cms\Catalog\PublicMaterialReader;
|
||||
use App\Filament\Resources\Combinations\CombinationResource;
|
||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||
use App\Filament\Resources\Courses\CourseResource;
|
||||
use App\Filament\Resources\Exercises\ExerciseResource;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@@ -111,7 +113,7 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
|
||||
'identity' => 'medium:'.$element->id,
|
||||
'open_url' => route('content.preview', $version),
|
||||
'open_label' => 'Medium ansehen',
|
||||
'edit_url' => null,
|
||||
'edit_url' => ContentElementResource::getUrl('view', ['record' => $element]),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -262,7 +264,7 @@ public function search(string $query, string $scope, int $exceptCompositionId):
|
||||
/**
|
||||
* @return array{items: list<array<string, string|null>>, more: bool}
|
||||
*/
|
||||
public function browse(string $query, string $kind, string $dimension, int $exceptCompositionId): array
|
||||
public function browse(string $query, string $kind, string $dimension, int $exceptCompositionId, bool $elementsOnly = false): array
|
||||
{
|
||||
$query = trim($query);
|
||||
$like = '%'.str_replace(['%', '_'], ['', ''], $query).'%';
|
||||
@@ -294,7 +296,7 @@ public function browse(string $query, string $kind, string $dimension, int $exce
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($kind, ['alle', 'modul'], true)) {
|
||||
if (! $elementsOnly && in_array($kind, ['alle', 'modul'], true)) {
|
||||
$latestCompositions = CompositionVersion::query()
|
||||
->selectRaw('MAX(id)')
|
||||
->where('status', ContentVersionStatus::Bereit)
|
||||
@@ -372,6 +374,8 @@ public function browse(string $query, string $kind, string $dimension, int $exce
|
||||
}
|
||||
}
|
||||
|
||||
$rows = $this->withVisibility($rows);
|
||||
|
||||
return [
|
||||
'items' => array_slice($rows, 0, $limit),
|
||||
'more' => count($rows) > $limit,
|
||||
@@ -400,6 +404,42 @@ public function cardUrl(string $kind, int $id, ?string $path): ?string
|
||||
return route('editorial.card', ['kind' => $kind, 'subject' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<array<string, mixed>> $rows
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
private function withVisibility(array $rows): array
|
||||
{
|
||||
$ids = [];
|
||||
|
||||
foreach ($rows as $row) {
|
||||
if (isset($row['element_id'])) {
|
||||
$ids[] = (int) $row['element_id'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($ids === []) {
|
||||
return $rows;
|
||||
}
|
||||
|
||||
$reader = app(PublicMaterialReader::class);
|
||||
$elements = ContentElement::query()
|
||||
->with('editorialContentKind')
|
||||
->whereIn('id', array_values(array_unique($ids)))
|
||||
->get()
|
||||
->keyBy('id');
|
||||
|
||||
foreach ($rows as $index => $row) {
|
||||
$element = $elements->get((int) ($row['element_id'] ?? 0));
|
||||
|
||||
if ($element instanceof ContentElement) {
|
||||
$rows[$index]['visibility'] = $reader->visibilityNote($element);
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Builder<ContentElement> $builder
|
||||
*/
|
||||
@@ -408,6 +448,7 @@ private function constrainElement($builder, string $query, string $like, string
|
||||
$outputs = match ($kind) {
|
||||
'film' => ['film'],
|
||||
'text' => ['text'],
|
||||
'bild' => ['bild'],
|
||||
'dokument' => ['pdf', 'document'],
|
||||
default => null,
|
||||
};
|
||||
|
||||
@@ -66,6 +66,27 @@ public function classifications(): array
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $filters
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function cardFor(ContentElement $element, bool $canEdit): array
|
||||
{
|
||||
$element->loadMissing(['versions', 'pillars']);
|
||||
$versionIds = $element->versions->pluck('id')->all();
|
||||
|
||||
return $this->card(
|
||||
$element,
|
||||
$this->portrait($element),
|
||||
$this->placements($versionIds)[$element->id] ?? [],
|
||||
$this->licenses($versionIds)[$element->id] ?? [],
|
||||
$canEdit,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $filters
|
||||
* @return list<array<string, mixed>>
|
||||
|
||||
Reference in new issue
Block a user