Skip to content
Snippets Groups Projects
Commit 5417be00 authored by Benjamin Bellamy's avatar Benjamin Bellamy :speech_balloon: Committed by Yassine Doghri
Browse files

fix: remove required for other_categories field and add podcast_id to latest podcasts query

parent 2d44b457
No related branches found
No related tags found
No related merge requests found
...@@ -424,9 +424,10 @@ class Podcast extends BaseController ...@@ -424,9 +424,10 @@ class Podcast extends BaseController
return redirect()->route('podcast-view', [$this->podcast->id]); return redirect()->route('podcast-view', [$this->podcast->id]);
} }
public function latestEpisodes(int $limit) public function latestEpisodes(int $limit, int $podcast_id)
{ {
$episodes = (new EpisodeModel()) $episodes = (new EpisodeModel())
->where('podcast_id', $podcast_id)
->orderBy('created_at', 'desc') ->orderBy('created_at', 'desc')
->findAll($limit); ->findAll($limit);
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
'id' => 'image', 'id' => 'image',
'name' => 'image', 'name' => 'image',
'class' => 'form-input', 'class' => 'form-input',
'required' => 'required', 'required' => 'required',
'type' => 'file', 'type' => 'file',
'accept' => '.jpg,.jpeg,.png', 'accept' => '.jpg,.jpeg,.png',
...@@ -65,21 +64,13 @@ ...@@ -65,21 +64,13 @@
hint_tooltip(lang('Podcast.form.type.hint'), 'ml-1') ?> hint_tooltip(lang('Podcast.form.type.hint'), 'ml-1') ?>
</legend> </legend>
<?= form_radio( <?= form_radio(
[ ['id' => 'episodic', 'name' => 'type', 'class' => 'form-radio-btn'],
'id' => 'episodic',
'name' => 'type',
'class' => 'form-radio-btn',
],
'episodic', 'episodic',
old('type') ? old('type') == 'episodic' : true old('type') ? old('type') == 'episodic' : true
) ?> ) ?>
<label for="episodic"><?= lang('Podcast.form.type.episodic') ?></label> <label for="episodic"><?= lang('Podcast.form.type.episodic') ?></label>
<?= form_radio( <?= form_radio(
[ ['id' => 'serial', 'name' => 'type', 'class' => 'form-radio-btn'],
'id' => 'serial',
'name' => 'type',
'class' => 'form-radio-btn',
],
'serial', 'serial',
old('type') ? old('type') == 'serial' : false old('type') ? old('type') == 'serial' : false
) ?> ) ?>
...@@ -124,7 +115,6 @@ ...@@ -124,7 +115,6 @@
<?= form_label( <?= form_label(
lang('Podcast.form.other_categories'), lang('Podcast.form.other_categories'),
'other_categories', 'other_categories',
[], [],
'', '',
...@@ -137,7 +127,6 @@ ...@@ -137,7 +127,6 @@
[ [
'id' => 'other_categories', 'id' => 'other_categories',
'class' => 'mb-4', 'class' => 'mb-4',
'required' => 'required',
'data-max-item-count' => '2', 'data-max-item-count' => '2',
] ]
) ?> ) ?>
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<?= view_cell('\App\Controllers\Admin\Podcast::latestEpisodes', [ <?= view_cell('\App\Controllers\Admin\Podcast::latestEpisodes', [
'limit' => 5, 'limit' => 5,
'podcast_id' => $podcast->id,
]) ?> ]) ?>
<?= $this->endSection() ?> <?= $this->endSection() ?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment