fix(podcast-form): move fediverse section below author section

This commit is contained in:
Yassine Doghri 2023-11-29 16:00:28 +00:00
parent 18e2633a49
commit 1861d67971
5 changed files with 66 additions and 45 deletions

View File

@ -688,4 +688,16 @@ class Episode extends Entity
return url_to('episode-preview', (string) $this->preview_id);
}
/**
* Returns the episode's clip count
*/
public function getClipCount(): int|string
{
if ($this->id === null) {
throw new RuntimeException('Episode must be created before getting number of video clips.');
}
return (new ClipModel())->getClipCount($this->podcast_id, $this->id);
}
}

View File

@ -173,6 +173,16 @@ class ClipModel extends Model
]);
}
public function getClipCount(int $podcastId, int $episodeId): int
{
return $this
->where([
'podcast_id' => $podcastId,
'episode_id' => $episodeId,
])
->countAllResults();
}
public function clearVideoClipCache(int $clipId): void
{
cache()

View File

@ -6,9 +6,11 @@ $episodeNavigation = [
'items' => ['episode-view', 'episode-edit', 'episode-persons-manage', 'embed-add'],
],
'clips' => [
'icon' => 'clapperboard',
'items' => ['video-clips-list', 'video-clips-create', 'soundbites-list', 'soundbites-create'],
'add-cta' => 'video-clips-create',
'icon' => 'clapperboard',
'items' => ['video-clips-list', 'video-clips-create', 'soundbites-list', 'soundbites-create'],
'count' => $episode->getClipCount(),
'count-route' => 'video-clips-list',
'add-cta' => 'video-clips-create',
],
]; ?>

View File

@ -56,27 +56,6 @@
isChecked="false" ><?= lang('Podcast.form.type.serial') ?></Forms.RadioButton>
</div>
</fieldset>
</Forms.Section>
<Forms.Section
title="<?= lang('Podcast.form.fediverse_section_title') ?>"
subtitle="<?= lang('Podcast.form.fediverse_section_subtitle') ?>" >
<div class="flex flex-col">
<Forms.Label for="handle" hint="<?= lang('Podcast.form.handle_hint') ?>"><?= lang('Podcast.form.handle') ?></Forms.Label>
<div class="relative">
<Icon glyph="at" class="absolute inset-0 h-full text-xl opacity-40 left-3" />
<Forms.Input name="handle" class="w-full pl-8" required="true" />
</div>
</div>
<Forms.Field
name="banner"
label="<?= lang('Podcast.form.banner') ?>"
helper="<?= lang('Podcast.form.banner_size_hint') ?>"
type="file"
accept=".jpg,.jpeg,.png" />
</Forms.Section>
<Forms.Section
@ -153,6 +132,25 @@
</Forms.Section>
<Forms.Section
title="<?= lang('Podcast.form.fediverse_section_title') ?>" >
<div class="flex flex-col">
<Forms.Label for="handle" hint="<?= lang('Podcast.form.handle_hint') ?>"><?= lang('Podcast.form.handle') ?></Forms.Label>
<div class="relative">
<Icon glyph="at" class="absolute inset-0 h-full text-xl opacity-40 left-3" />
<Forms.Input name="handle" class="w-full pl-8" required="true" />
</div>
</div>
<Forms.Field
name="banner"
label="<?= lang('Podcast.form.banner') ?>"
helper="<?= lang('Podcast.form.banner_size_hint') ?>"
type="file"
accept=".jpg,.jpeg,.png" />
</Forms.Section>
<Forms.Section title="<?= lang('Podcast.form.premium') ?>">
<Forms.Toggler class="mt-2" name="premium_by_default" value="yes" checked="false" hint="<?= lang('Podcast.form.premium_by_default_hint') ?>">
<?= lang('Podcast.form.premium_by_default') ?></Forms.Toggler>

View File

@ -78,27 +78,6 @@
isChecked="<?= $podcast->type === 'serial' ? 'true' : 'false' ?>" ><?= lang('Podcast.form.type.serial') ?></Forms.RadioButton>
</div>
</fieldset>
</Forms.Section>
<Forms.Section
title="<?= lang('Podcast.form.fediverse_section_title') ?>" >
<div class="flex flex-col">
<Forms.Label for="handle" hint="<?= lang('Podcast.form.handle_hint') ?>"><?= lang('Podcast.form.handle') ?></Forms.Label>
<div class="relative">
<Icon glyph="at" class="absolute inset-0 h-full text-xl opacity-40 left-3" />
<Forms.Input name="handle" value="<?= $podcast->handle ?>" class="w-full pl-8" required="true" readonly="true" />
</div>
</div>
<Forms.Field
name="banner"
label="<?= lang('Podcast.form.banner') ?>"
helper="<?= lang('Podcast.form.banner_size_hint') ?>"
type="file"
accept=".jpg,.jpeg,.png" />
</Forms.Section>
<Forms.Section
@ -181,6 +160,26 @@
</Forms.Section>
<Forms.Section
title="<?= lang('Podcast.form.fediverse_section_title') ?>" >
<div class="flex flex-col">
<Forms.Label for="handle" hint="<?= lang('Podcast.form.handle_hint') ?>"><?= lang('Podcast.form.handle') ?></Forms.Label>
<div class="relative">
<Icon glyph="at" class="absolute inset-0 h-full text-xl opacity-40 left-3" />
<Forms.Input name="handle" value="<?= $podcast->handle ?>" class="w-full pl-8" required="true" readonly="true" />
</div>
</div>
<Forms.Field
name="banner"
label="<?= lang('Podcast.form.banner') ?>"
helper="<?= lang('Podcast.form.banner_size_hint') ?>"
type="file"
accept=".jpg,.jpeg,.png" />
</Forms.Section>
<Forms.Section title="<?= lang('Podcast.form.premium') ?>">
<Forms.Toggler class="mt-2" name="premium_by_default" value="yes" checked="<?= $podcast->is_premium_by_default ? 'true' : 'false' ?>" hint="<?= lang('Podcast.form.premium_by_default_hint') ?>">
<?= lang('Podcast.form.premium_by_default') ?></Forms.Toggler>