diff --git a/app/Http/Livewire/News/ArticleOverview.php b/app/Http/Livewire/News/ArticleOverview.php index cf241e24..0c84fc68 100644 --- a/app/Http/Livewire/News/ArticleOverview.php +++ b/app/Http/Livewire/News/ArticleOverview.php @@ -13,6 +13,12 @@ class ArticleOverview extends Component use Actions; use NostrTrait; + public array $filters = []; + + protected $queryString = [ + 'filters' => ['except' => ''], + ]; + public function nostr($id) { $libraryItem = LibraryItem::query() @@ -56,6 +62,11 @@ class ArticleOverview extends Component $this->emit('$refresh'); } + public function resetFiltering() + { + return to_route('article.overview'); + } + public function render() { return view('livewire.news.article-overview', [ @@ -65,6 +76,11 @@ class ArticleOverview extends Component 'lecturer', 'tags', ]) + ->when( + isset($this->filters['author']), + fn($query) => $query->whereHas('lecturer', + fn($query) => $query->where('lecturers.slug', + $this->filters['author']))) ->where('type', 'markdown_article') ->where('news', true) ->orderByDesc('created_at') diff --git a/app/Http/Livewire/News/AuthorsOverview.php b/app/Http/Livewire/News/AuthorsOverview.php new file mode 100644 index 00000000..30f6be4d --- /dev/null +++ b/app/Http/Livewire/News/AuthorsOverview.php @@ -0,0 +1,23 @@ + Lecturer::query() + ->whereHas('libraryItems', function ($query) { + $query->where('library_items.news', true); + }) + ->withCount([ + 'libraryItems' => fn($query) => $query->where('library_items.news', true), + ]) + ->get(), + ]); + } +} diff --git a/resources/lang/de.json b/resources/lang/de.json index e75ab36c..cd4ba11d 100644 --- a/resources/lang/de.json +++ b/resources/lang/de.json @@ -849,5 +849,10 @@ "Videos": "Videos", "Bücher": "Bücher", "Embed code for the map copied!": "Embed-Code für die Karte kopiert!", - "Copy embed code for the map": "Kopiere Embed-Code für die Karte" + "Copy embed code for the map": "Kopiere Embed-Code für die Karte", + "Authors": "News-Autoren", + "Reset filtering": "Filter zurücksetzen", + "News articles writer": "News-Artikel-Autoren", + "Click on any of the authors to see their articles.": "Klicke auf einen der Autoren, um die Artikel zu lesen.", + "articles": "Artikel" } diff --git a/resources/lang/en.json b/resources/lang/en.json index ea06a635..33181cb8 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -847,5 +847,10 @@ "Videos": "", "Bücher": "", "Embed code for the map copied!": "", - "Copy embed code for the map": "" + "Copy embed code for the map": "", + "Authors": "", + "Reset filtering": "", + "News articles writer": "", + "Click on any of the authors to see their articles.": "", + "articles": "" } \ No newline at end of file diff --git a/resources/lang/es.json b/resources/lang/es.json index 0afb2283..5d3c259a 100644 --- a/resources/lang/es.json +++ b/resources/lang/es.json @@ -847,5 +847,10 @@ "Videos": "", "Bücher": "", "Embed code for the map copied!": "", - "Copy embed code for the map": "" + "Copy embed code for the map": "", + "Authors": "", + "Reset filtering": "", + "News articles writer": "", + "Click on any of the authors to see their articles.": "", + "articles": "" } \ No newline at end of file diff --git a/resources/lang/fr.json b/resources/lang/fr.json index 5c2853c6..04d9fac0 100644 --- a/resources/lang/fr.json +++ b/resources/lang/fr.json @@ -848,5 +848,10 @@ "Videos": "", "Bücher": "", "Embed code for the map copied!": "", - "Copy embed code for the map": "" + "Copy embed code for the map": "", + "Authors": "", + "Reset filtering": "", + "News articles writer": "", + "Click on any of the authors to see their articles.": "", + "articles": "" } \ No newline at end of file diff --git a/resources/lang/hr.json b/resources/lang/hr.json index 31ed89de..36352c4e 100644 --- a/resources/lang/hr.json +++ b/resources/lang/hr.json @@ -848,5 +848,10 @@ "Videos": "", "Bücher": "", "Embed code for the map copied!": "", - "Copy embed code for the map": "" + "Copy embed code for the map": "", + "Authors": "", + "Reset filtering": "", + "News articles writer": "", + "Click on any of the authors to see their articles.": "", + "articles": "" } \ No newline at end of file diff --git a/resources/lang/it.json b/resources/lang/it.json index 3beebc5e..0f8e3d26 100644 --- a/resources/lang/it.json +++ b/resources/lang/it.json @@ -848,5 +848,10 @@ "Videos": "", "Bücher": "", "Embed code for the map copied!": "", - "Copy embed code for the map": "" + "Copy embed code for the map": "", + "Authors": "", + "Reset filtering": "", + "News articles writer": "", + "Click on any of the authors to see their articles.": "", + "articles": "" } \ No newline at end of file diff --git a/resources/lang/mk.json b/resources/lang/mk.json index 9de35da2..cdde6919 100644 --- a/resources/lang/mk.json +++ b/resources/lang/mk.json @@ -848,5 +848,10 @@ "Videos": "", "Bücher": "", "Embed code for the map copied!": "", - "Copy embed code for the map": "" + "Copy embed code for the map": "", + "Authors": "", + "Reset filtering": "", + "News articles writer": "", + "Click on any of the authors to see their articles.": "", + "articles": "" } \ No newline at end of file diff --git a/resources/lang/pl.json b/resources/lang/pl.json index 32a42f64..04c6e68e 100644 --- a/resources/lang/pl.json +++ b/resources/lang/pl.json @@ -848,5 +848,10 @@ "Videos": "", "Bücher": "", "Embed code for the map copied!": "", - "Copy embed code for the map": "" + "Copy embed code for the map": "", + "Authors": "", + "Reset filtering": "", + "News articles writer": "", + "Click on any of the authors to see their articles.": "", + "articles": "" } \ No newline at end of file diff --git a/resources/lang/pt.json b/resources/lang/pt.json index 4db256e6..f5a8f81b 100644 --- a/resources/lang/pt.json +++ b/resources/lang/pt.json @@ -848,5 +848,10 @@ "Videos": "", "Bücher": "", "Embed code for the map copied!": "", - "Copy embed code for the map": "" + "Copy embed code for the map": "", + "Authors": "", + "Reset filtering": "", + "News articles writer": "", + "Click on any of the authors to see their articles.": "", + "articles": "" } \ No newline at end of file diff --git a/resources/lang/sv.json b/resources/lang/sv.json index 520aa6be..100241c9 100644 --- a/resources/lang/sv.json +++ b/resources/lang/sv.json @@ -810,5 +810,10 @@ "Videos": "", "Bücher": "", "Embed code for the map copied!": "", - "Copy embed code for the map": "" + "Copy embed code for the map": "", + "Authors": "", + "Reset filtering": "", + "News articles writer": "", + "Click on any of the authors to see their articles.": "", + "articles": "" } \ No newline at end of file diff --git a/resources/lang/tr.json b/resources/lang/tr.json index 80f71924..4a1b0bf5 100644 --- a/resources/lang/tr.json +++ b/resources/lang/tr.json @@ -822,5 +822,10 @@ "Videos": "", "Bücher": "", "Embed code for the map copied!": "", - "Copy embed code for the map": "" + "Copy embed code for the map": "", + "Authors": "", + "Reset filtering": "", + "News articles writer": "", + "Click on any of the authors to see their articles.": "", + "articles": "" } \ No newline at end of file diff --git a/resources/views/livewire/frontend/navigation/news.blade.php b/resources/views/livewire/frontend/navigation/news.blade.php index a518e851..94c74b5f 100644 --- a/resources/views/livewire/frontend/navigation/news.blade.php +++ b/resources/views/livewire/frontend/navigation/news.blade.php @@ -33,6 +33,12 @@ {{ __('News Article') }} + + + {{ __('Authors') }} + + diff --git a/resources/views/livewire/news/article-overview.blade.php b/resources/views/livewire/news/article-overview.blade.php index 9b35073f..6e5cbf6f 100644 --- a/resources/views/livewire/news/article-overview.blade.php +++ b/resources/views/livewire/news/article-overview.blade.php @@ -12,7 +12,12 @@
-
+
+ @if(isset($filters['author'])) + {{ __('Reset filtering') }} + + @endif @auth + {{-- HEADER --}} + + +
+
+
+

{{ __('News articles writer') }}

+

+ {{ __('Click on any of the authors to see their articles.') }} +

+
+ +
+
+ +
+ + +
+
diff --git a/routes/web.php b/routes/web.php index b6a3b5c8..e21bd8fb 100644 --- a/routes/web.php +++ b/routes/web.php @@ -26,6 +26,10 @@ Route::middleware([]) ->get('/news', \App\Http\Livewire\News\ArticleOverview::class) ->name('article.overview'); +Route::middleware([]) + ->get('/news/authors', \App\Http\Livewire\News\AuthorsOverview::class) + ->name('authors.overview'); + /* * News * */