From 5417be0049288489a19c7b575aa77bd1e2bc0243 Mon Sep 17 00:00:00 2001 From: Benjamin Bellamy Date: Mon, 5 Oct 2020 08:44:51 +0000 Subject: [PATCH] fix: remove required for other_categories field and add podcast_id to latest podcasts query --- app/Controllers/Admin/Podcast.php | 3 ++- app/Views/admin/podcast/create.php | 15 ++------------- app/Views/admin/podcast/view.php | 1 + 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/app/Controllers/Admin/Podcast.php b/app/Controllers/Admin/Podcast.php index 794bcef3..439a86da 100644 --- a/app/Controllers/Admin/Podcast.php +++ b/app/Controllers/Admin/Podcast.php @@ -424,9 +424,10 @@ class Podcast extends BaseController return redirect()->route('podcast-view', [$this->podcast->id]); } - public function latestEpisodes(int $limit) + public function latestEpisodes(int $limit, int $podcast_id) { $episodes = (new EpisodeModel()) + ->where('podcast_id', $podcast_id) ->orderBy('created_at', 'desc') ->findAll($limit); diff --git a/app/Views/admin/podcast/create.php b/app/Views/admin/podcast/create.php index 138dad7d..e5bd33a0 100644 --- a/app/Views/admin/podcast/create.php +++ b/app/Views/admin/podcast/create.php @@ -27,7 +27,6 @@ 'id' => 'image', 'name' => 'image', 'class' => 'form-input', - 'required' => 'required', 'type' => 'file', 'accept' => '.jpg,.jpeg,.png', @@ -65,21 +64,13 @@ hint_tooltip(lang('Podcast.form.type.hint'), 'ml-1') ?> 'episodic', - 'name' => 'type', - 'class' => 'form-radio-btn', - ], + ['id' => 'episodic', 'name' => 'type', 'class' => 'form-radio-btn'], 'episodic', old('type') ? old('type') == 'episodic' : true ) ?> 'serial', - 'name' => 'type', - 'class' => 'form-radio-btn', - ], + ['id' => 'serial', 'name' => 'type', 'class' => 'form-radio-btn'], 'serial', old('type') ? old('type') == 'serial' : false ) ?> @@ -124,7 +115,6 @@ 'other_categories', 'class' => 'mb-4', - 'required' => 'required', 'data-max-item-count' => '2', ] ) ?> diff --git a/app/Views/admin/podcast/view.php b/app/Views/admin/podcast/view.php index e0bb6aef..bea7fbc5 100644 --- a/app/Views/admin/podcast/view.php +++ b/app/Views/admin/podcast/view.php @@ -25,6 +25,7 @@ 5, + 'podcast_id' => $podcast->id, ]) ?> endSection() ?>