Feed in der Mitarbeiter-App (0.54.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Failing after 15m6s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 15m58s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 15m42s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 15m21s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 1h1m41s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 1h2m13s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 23m20s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 23m33s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 1m17s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m57s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Failing after 15m6s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 15m58s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 15m42s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 15m21s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 1h1m41s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 1h2m13s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 23m20s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 23m33s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 1m17s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m57s
Feed-Registry mit Anbietern (Neu im Team, Neuigkeiten, Termine, Umfragen), Schnellaktionen je nach Rechten, Nachladen über /feed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ab76b65aff
commit
8acc0cfd8b
152 changed files with 950 additions and 361 deletions
|
|
@ -5,6 +5,7 @@ namespace Inhaus\Plugins\Events;
|
|||
use App\Dashboard\Widgets;
|
||||
use App\Digest\Digest;
|
||||
use App\Editorial\Editorial;
|
||||
use App\Feed\Feed;
|
||||
use App\Media\ImagePaths;
|
||||
use App\Media\MediaUsages;
|
||||
use App\Models\User;
|
||||
|
|
@ -15,6 +16,7 @@ use App\Plugins\Plugin;
|
|||
use App\Search\GlobalSearch;
|
||||
use App\Support\Abilities;
|
||||
use App\Support\Navigation;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Inhaus\Plugins\Events\Http\Resources\EventResource;
|
||||
use Inhaus\Plugins\Events\Models\Event;
|
||||
|
|
@ -71,6 +73,29 @@ class EventsPlugin extends Plugin
|
|||
$this->app->make(Editorial::class)->meta('events', icon: 'calendar-days',
|
||||
create: fn (User $user) => $user->can('events.manage') ? ['label' => 'Neuer Termin', 'href' => route('events.create')] : null);
|
||||
|
||||
// Feed: neu eingetragene, noch anstehende Termine
|
||||
if (class_exists(Feed::class)) {
|
||||
$this->app->make(Feed::class)->add('events', fn (User $user, ?CarbonImmutable $before, int $limit) => Event::query()
|
||||
->upcoming()->visibleTo($user)->with('author')
|
||||
->where('created_at', '>=', now()->subDays(60))
|
||||
->when($before, fn ($query) => $query->where('created_at', '<', $before))
|
||||
->reorder()->latest('created_at')->limit($limit)->get()
|
||||
->map(fn (Event $event) => [
|
||||
'id' => 'event-'.$event->id,
|
||||
'kind' => 'event',
|
||||
'time' => $event->created_at,
|
||||
'actor' => Feed::person($event->author),
|
||||
'action' => 'hat einen Termin eingetragen',
|
||||
'badge' => 'Neuer Termin',
|
||||
'title' => $event->title,
|
||||
'text' => $event->starts_at->translatedFormat('l, j. F Y, H:i').' Uhr'.($event->location ? ' · '.$event->location : ''),
|
||||
'image_url' => $event->imageUrl('large'),
|
||||
'url' => route('events.show', $event),
|
||||
'date' => $event->starts_at->toIso8601String(),
|
||||
'cta' => ['label' => 'Ansehen', 'url' => route('events.show', $event)],
|
||||
]));
|
||||
}
|
||||
|
||||
$this->app->make(Widgets::class)->add('events.upcoming', 'events::Upcoming', 'aside', sort: 20, props: fn (User $user) => [
|
||||
'events' => EventResource::collection(Event::query()->upcoming()->visibleTo($user)->limit(4)->get())->resolve(),
|
||||
], label: 'Termine', mobileSort: 30);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use App\Accessibility\EasyLanguage;
|
|||
use App\Dashboard\Widgets;
|
||||
use App\Digest\Digest;
|
||||
use App\Editorial\Editorial;
|
||||
use App\Feed\Feed;
|
||||
use App\Media\ImagePaths;
|
||||
use App\Media\MediaUsages;
|
||||
use App\Models\User;
|
||||
|
|
@ -196,6 +197,26 @@ class NewsPlugin extends Plugin
|
|||
|
||||
private function registerWidgets(Widgets $widgets): void
|
||||
{
|
||||
// Feed der Mitarbeiter-App: jede Neuigkeit als Beitrag ihrer Autorin bzw. ihres Autors
|
||||
if (class_exists(Feed::class)) {
|
||||
$this->app->make(Feed::class)->add('news', fn (User $user, ?CarbonImmutable $before, int $limit) => NewsPost::query()
|
||||
->published()->visibleTo($user)->with(['category', 'author'])->withStats($user)
|
||||
->when($before, fn ($query) => $query->where('published_at', '<', $before))
|
||||
->latest('published_at')->limit($limit)->get()
|
||||
->map(fn (NewsPost $post) => [
|
||||
'id' => 'news-'.$post->id,
|
||||
'time' => $post->published_at,
|
||||
'actor' => Feed::person($post->author),
|
||||
'action' => 'hat eine Neuigkeit veröffentlicht',
|
||||
'badge' => $post->category?->name,
|
||||
'title' => $post->title,
|
||||
'text' => (string) $post->teaser,
|
||||
'image_url' => $post->coverUrl('large'),
|
||||
'url' => '/neuigkeiten/'.$post->slug,
|
||||
'stats' => ['likes' => (int) ($post->likes_count ?? 0), 'comments' => $post->comments_enabled ? (int) ($post->comments_count ?? 0) : null],
|
||||
]));
|
||||
}
|
||||
|
||||
// Slider: hervorgehobene Beiträge mit Bild, sonst die neuesten mit Bild.
|
||||
$widgets->add('news.hero', 'news::Hero', 'hero', sort: 10, props: function (User $user) {
|
||||
$featured = $this->featured($user);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace Inhaus\Plugins\Umfragen;
|
|||
use App\Dashboard\Widgets;
|
||||
use App\Digest\Digest;
|
||||
use App\Editorial\Editorial;
|
||||
use App\Feed\Feed;
|
||||
use App\Models\User;
|
||||
use App\Pagebuilder\Blocks;
|
||||
use App\Pagebuilder\BlockType;
|
||||
|
|
@ -13,6 +14,7 @@ use App\Plugins\Plugin;
|
|||
use App\Support\Abilities;
|
||||
use App\Support\Navigation;
|
||||
use App\Tasks\Tasks;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Support\Facades\Schedule;
|
||||
use Inhaus\Plugins\Umfragen\Models\Poll;
|
||||
|
||||
|
|
@ -62,6 +64,24 @@ class UmfragenPlugin extends Plugin
|
|||
])->values()->all(), sort: 30);
|
||||
}
|
||||
|
||||
// Feed: neue Umfragen
|
||||
if (class_exists(Feed::class)) {
|
||||
$this->app->make(Feed::class)->add('umfragen', fn (User $user, ?CarbonImmutable $before, int $limit) => Poll::query()
|
||||
->open()->visibleTo($user)
|
||||
->when($before, fn ($query) => $query->where('published_at', '<', $before))
|
||||
->latest('published_at')->limit($limit)->get()
|
||||
->map(fn (Poll $poll) => [
|
||||
'id' => 'poll-'.$poll->id,
|
||||
'kind' => 'poll',
|
||||
'time' => $poll->published_at,
|
||||
'badge' => 'Umfrage',
|
||||
'title' => $poll->title,
|
||||
'text' => $poll->closes_at ? 'Abstimmen bis '.$poll->closes_at->translatedFormat('l, j. F') : '',
|
||||
'url' => route('polls.show', $poll),
|
||||
'cta' => ['label' => $poll->hasVoted($user) ? 'Ergebnis ansehen' : 'Abstimmen', 'url' => route('polls.show', $poll)],
|
||||
]));
|
||||
}
|
||||
|
||||
// Baustein: Umfrage direkt in Seite oder Beitrag
|
||||
$this->app->make(Blocks::class)->add(BlockType::make('umfragen.poll', 'Umfrage', 'vote', 'dynamic', 'umfragen::PollBlock')
|
||||
->description('Eine Umfrage direkt auf der Seite beantworten lassen.')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue