fix: move monetization outside of podcast form + add broadcast section to podcast menu

This commit is contained in:
Yassine Doghri 2023-11-16 16:24:29 +00:00
parent 02d4ba69ac
commit dff85168b3
15 changed files with 142 additions and 112 deletions

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4.92893 2.92871L6.34315 4.34292C4.89543 5.79064 4 7.79064 4 9.99978C4 12.2089 4.89543 14.2089 6.34315 15.6566L4.92893 17.0708C3.11929 15.2612 2 12.7612 2 9.99978C2 7.23835 3.11929 4.73836 4.92893 2.92871ZM19.0711 2.92871C20.8807 4.73836 22 7.23835 22 9.99978C22 12.7612 20.8807 15.2612 19.0711 17.0708L17.6569 15.6566C19.1046 14.2089 20 12.2089 20 9.99978C20 7.79064 19.1046 5.79064 17.6569 4.34292L19.0711 2.92871ZM7.75736 5.75714L9.17157 7.17135C8.44771 7.89521 8 8.89521 8 9.99978C8 11.1043 8.44771 12.1043 9.17157 12.8282L7.75736 14.2424C6.67157 13.1566 6 11.6566 6 9.99978C6 8.34292 6.67157 6.84292 7.75736 5.75714ZM16.2426 5.75714C17.3284 6.84292 18 8.34292 18 9.99978C18 11.6566 17.3284 13.1566 16.2426 14.2424L14.8284 12.8282C15.5523 12.1043 16 11.1043 16 9.99978C16 8.89521 15.5523 7.89521 14.8284 7.17135L16.2426 5.75714ZM12 11.9998C10.8954 11.9998 10 11.1043 10 9.99978C10 8.89521 10.8954 7.99978 12 7.99978C13.1046 7.99978 14 8.89521 14 9.99978C14 11.1043 13.1046 11.9998 12 11.9998ZM12 13.9998C12.5798 13.9998 13.0774 14.4128 13.1843 14.9827L14.5 21.9998H9.5L10.8157 14.9827C10.9226 14.4128 11.4202 13.9998 12 13.9998Z"></path></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.0049 22.0029C6.48204 22.0029 2.00488 17.5258 2.00488 12.0029C2.00488 6.48008 6.48204 2.00293 12.0049 2.00293C17.5277 2.00293 22.0049 6.48008 22.0049 12.0029C22.0049 17.5258 17.5277 22.0029 12.0049 22.0029ZM8.50488 14.0029V16.0029H11.0049V18.0029H13.0049V16.0029H14.0049C15.3856 16.0029 16.5049 14.8836 16.5049 13.5029C16.5049 12.1222 15.3856 11.0029 14.0049 11.0029H10.0049C9.72874 11.0029 9.50488 10.7791 9.50488 10.5029C9.50488 10.2268 9.72874 10.0029 10.0049 10.0029H15.5049V8.00293H13.0049V6.00293H11.0049V8.00293H10.0049C8.62417 8.00293 7.50488 9.12222 7.50488 10.5029C7.50488 11.8836 8.62417 13.0029 10.0049 13.0029H14.0049C14.281 13.0029 14.5049 13.2268 14.5049 13.5029C14.5049 13.7791 14.281 14.0029 14.0049 14.0029H8.50488Z"></path></svg>

After

Width:  |  Height:  |  Size: 820 B

View File

@ -179,6 +179,14 @@ $routes->group(
],
);
});
$routes->get('monetization-other', 'PodcastController::monetizationOther/$1', [
'as' => 'podcast-monetization-other',
'filter' => 'permission:podcast#.edit',
]);
$routes->post('monetization-other', 'PodcastController::monetizationOtherAction/$1', [
'as' => 'podcast-monetization-other',
'filter' => 'permission:podcast#.edit',
]);
$routes->group('analytics', static function ($routes): void {
$routes->get('/', 'PodcastController::viewAnalytics/$1', [
'as' => 'podcast-analytics',

View File

@ -198,15 +198,6 @@ class PodcastController extends BaseController
->with('errors', $this->validator->getErrors());
}
if (
($partnerId = $this->request->getPost('partner_id')) === '' ||
($partnerLinkUrl = $this->request->getPost('partner_link_url')) === '' ||
($partnerImageUrl = $this->request->getPost('partner_image_url')) === '') {
$partnerId = null;
$partnerLinkUrl = null;
$partnerImageUrl = null;
}
$db = db_connect();
$db->transStart();
@ -231,13 +222,7 @@ class PodcastController extends BaseController
'location' => $this->request->getPost('location_name') === '' ? null : new Location(
$this->request->getPost('location_name')
),
'payment_pointer' => $this->request->getPost(
'payment_pointer'
) === '' ? null : $this->request->getPost('payment_pointer'),
'custom_rss_string' => $this->request->getPost('custom_rss'),
'partner_id' => $partnerId,
'partner_link_url' => $partnerLinkUrl,
'partner_image_url' => $partnerImageUrl,
'is_blocked' => $this->request->getPost('block') === 'yes',
'is_completed' => $this->request->getPost('complete') === 'yes',
'is_locked' => $this->request->getPost('lock') === 'yes',
@ -311,15 +296,6 @@ class PodcastController extends BaseController
->with('errors', $this->validator->getErrors());
}
if (
($partnerId = $this->request->getPost('partner_id')) === '' ||
($partnerLinkUrl = $this->request->getPost('partner_link_url')) === '' ||
($partnerImageUrl = $this->request->getPost('partner_image_url')) === '') {
$partnerId = null;
$partnerLinkUrl = null;
$partnerImageUrl = null;
}
$this->podcast->updated_by = (int) user_id();
$this->podcast->title = $this->request->getPost('title');
@ -341,16 +317,11 @@ class PodcastController extends BaseController
$this->podcast->location = $this->request->getPost('location_name') === '' ? null : new Location(
$this->request->getPost('location_name')
);
$this->podcast->payment_pointer = $this->request->getPost(
'payment_pointer'
) === '' ? null : $this->request->getPost('payment_pointer');
$this->podcast->custom_rss_string = $this->request->getPost('custom_rss');
$this->podcast->new_feed_url = $this->request->getPost('new_feed_url') === '' ? null : $this->request->getPost(
'new_feed_url'
);
$this->podcast->partner_id = $partnerId;
$this->podcast->partner_link_url = $partnerLinkUrl;
$this->podcast->partner_image_url = $partnerImageUrl;
$this->podcast->is_blocked = $this->request->getPost('block') === 'yes';
$this->podcast->is_completed =
$this->request->getPost('complete') === 'yes';
@ -395,6 +366,53 @@ class PodcastController extends BaseController
);
}
public function monetizationOther(): string
{
helper('form');
$data = [
'podcast' => $this->podcast,
];
replace_breadcrumb_params([
0 => $this->podcast->at_handle,
]);
return view('podcast/monetization_other', $data);
}
public function monetizationOtherAction(): RedirectResponse
{
if (
($partnerId = $this->request->getPost('partner_id')) === '' ||
($partnerLinkUrl = $this->request->getPost('partner_link_url')) === '' ||
($partnerImageUrl = $this->request->getPost('partner_image_url')) === '') {
$partnerId = null;
$partnerLinkUrl = null;
$partnerImageUrl = null;
}
$this->podcast->payment_pointer = $this->request->getPost(
'payment_pointer'
) === '' ? null : $this->request->getPost('payment_pointer');
$this->podcast->partner_id = $partnerId;
$this->podcast->partner_link_url = $partnerLinkUrl;
$this->podcast->partner_image_url = $partnerImageUrl;
$podcastModel = new PodcastModel();
if (! $podcastModel->update($this->podcast->id, $this->podcast)) {
return redirect()
->back()
->withInput()
->with('errors', $podcastModel->errors());
}
return redirect()->route('podcast-monetization-other', [$this->podcast->id])->with(
'message',
lang('Podcast.messages.editSuccess')
);
}
public function deleteBanner(): RedirectResponse
{
if (! $this->podcast->banner instanceof Image) {

View File

@ -40,6 +40,7 @@ return [
],
'upload_file' => 'Upload a file',
'remote_url' => 'Remote URL',
'save' => 'Save',
],
'play_episode_button' => [
'play' => 'Play',

View File

@ -27,14 +27,15 @@ return [
'podcast-analytics-players' => 'Players',
'podcast-analytics-listening-time' => 'Listening time',
'podcast-analytics-time-periods' => 'Time periods',
'premium' => 'Premium',
'monetization' => 'Monetization',
'subscription-list' => 'All subscriptions',
'subscription-create' => 'Add subscription',
'contributors' => 'Contributors',
'contributor-list' => 'All contributors',
'contributor-add' => 'Add contributor',
'platforms' => 'External platforms',
'platforms-podcasting' => 'Podcasting',
'broadcast' => 'Broadcast',
'platforms-podcasting' => 'Podcasting apps',
'platforms-social' => 'Social networks',
'platforms-funding' => 'Funding',
'platforms-funding' => 'Funding links',
'podcast-monetization-other' => 'Other',
];

View File

@ -84,7 +84,7 @@ $routes->group(
'as' => 'contributor-list',
'filter' => 'permission:podcast#.manage-contributors',
]);
$routes->get('add', 'ContributorController::add/$1', [
$routes->get('add', 'ContributorController::create/$1', [
'as' => 'contributor-add',
'filter' => 'permission:podcast#.manage-contributors',
]);

View File

@ -32,8 +32,8 @@ $isEpisodeArea = isset($podcast) && isset($episode);
<?= $this->include('_partials/_nav_header') ?>
<?= $this->include('_partials/_nav_aside') ?>
<main class="relative max-w-full col-start-1 row-start-2 col-span-full md:col-start-2 md:col-span-1">
<header class="z-40 flex items-center px-4 border-b bg-elevated md:px-12 sticky-header-outer border-subtle">
<div class="flex flex-col justify-end w-full -mt-4 sticky-header-inner">
<header class="z-40 flex flex-col items-start justify-center px-4 border-b bg-elevated md:px-12 sticky-header-outer border-subtle">
<div class="flex flex-col justify-end w-full -mt-4 sticky-header-inner bg-elevated">
<?= render_breadcrumb('text-xs items-center flex') ?>
<div class="flex justify-between py-1">
<div class="flex flex-wrap items-center truncate">
@ -42,14 +42,15 @@ $isEpisodeArea = isset($podcast) && isset($episode);
<IconButton uri="<?= route_to('subscription-list', $podcast->id) ?>" glyph="exchange-dollar" variant="secondary" size="large" class="p-0 mr-2 border-0"><?= ($isEpisodeArea && $episode->is_premium) ? lang('PremiumPodcasts.episode_is_premium') : lang('PremiumPodcasts.podcast_is_premium') ?></IconButton>
<Heading tagName="h1" size="large" class="truncate"><?= $this->renderSection('pageTitle') ?></Heading>
</div>
<?php else: ?>
<?php else: ?>
<Heading tagName="h1" size="large" class="truncate"><?= $this->renderSection('pageTitle') ?></Heading>
<?php endif; ?>
<?php endif; ?>
<?= $this->renderSection('headerLeft') ?>
</div>
<div class="flex items-center flex-shrink-0 gap-x-2"><?= $this->renderSection('headerRight') ?></div>
</div>
</div>
<?= $this->renderSection('subtitle') ?>
</header>
<?php if ($isPodcastArea): ?>
<?php if (service('settings')->get('Import.current') === $podcast->handle): ?>

View File

@ -216,9 +216,10 @@
hint="<?= lang('Episode.form.custom_rss_hint') ?>"
/>
<Forms.Toggler name="block" value="yes" checked="false" hint="<?= lang('Episode.form.block_hint') ?>"><?= lang('Episode.form.block') ?></Forms.Toggler>
</Forms.Section>
<Forms.Toggler name="block" value="yes" checked="false" hint="<?= lang('Episode.form.block_hint') ?>"><?= lang('Episode.form.block') ?></Forms.Toggler>
<Button class="self-end" variant="primary" type="submit"><?= lang('Episode.form.submit_create') ?></Button>

View File

@ -274,10 +274,10 @@
content="<?= esc($episode->custom_rss_string) ?>"
/>
</Forms.Section>
<Forms.Toggler id="block" name="block" value="yes" checked="<?= $episode->is_blocked ? 'true' : 'false' ?>" hint="<?= lang('Episode.form.block_hint') ?>"><?= lang('Episode.form.block') ?></Forms.Toggler>
</Forms.Section>
</form>
<?php if ($episode->published_at === null): ?>

View File

@ -12,11 +12,6 @@ $podcastNavigation = [
'count' => $podcast->getEpisodesCount(),
'count-route' => 'episode-list',
],
'premium' => [
'icon' => 'exchange-dollar',
'add-cta' => 'subscription-create',
'items' => ['subscription-list', 'subscription-create'],
],
'analytics' => [
'icon' => 'line-chart',
'items' => [
@ -29,6 +24,23 @@ $podcastNavigation = [
'podcast-analytics-webpages',
],
],
'broadcast' => [
'icon' => 'broadcast',
'items' => [
'platforms-podcasting',
'platforms-social',
],
],
'monetization' => [
'icon' => 'money-dollar-circle',
'add-cta' => 'subscription-create',
'items' => [
'subscription-list',
'subscription-create',
'platforms-funding',
'podcast-monetization-other',
],
],
'contributors' => [
'icon' => 'group',
'items' => ['contributor-list', 'contributor-add'],
@ -36,14 +48,6 @@ $podcastNavigation = [
'count' => count($podcast->contributors),
'count-route' => 'contributor-list',
],
'platforms' => [
'icon' => 'link',
'items' => [
'platforms-podcasting',
'platforms-social',
'platforms-funding',
],
],
];
?>

View File

@ -177,34 +177,6 @@
</Forms.Section>
<Forms.Section
title="<?= lang('Podcast.form.monetization_section_title') ?>"
subtitle="<?= lang('Podcast.form.monetization_section_subtitle') ?>" >
<Forms.Field
name="payment_pointer"
label="<?= lang('Podcast.form.payment_pointer') ?>"
hint="<?= lang('Podcast.form.payment_pointer_hint') ?>" />
<fieldset class="flex flex-col items-start p-4 rounded bg-base">
<Heading tagName="legend" class="float-left" size="small"><?= lang('Podcast.form.partnership') ?></Heading>
<div class="flex flex-col w-full clear-left gap-x-2 gap-y-4 md:flex-row">
<div class="flex flex-col flex-shrink w-32">
<Forms.Label for="partner_id" hint="<?= lang('Podcast.form.partner_id_hint') ?>" isOptional="true"><?= lang('Podcast.form.partner_id') ?></Forms.Label>
<Forms.Input name="partner_id" />
</div>
<div class="flex flex-col flex-1">
<Forms.Label for="partner_link_url" hint="<?= lang('Podcast.form.partner_link_url_hint') ?>" isOptional="true"><?= lang('Podcast.form.partner_link_url') ?></Forms.Label>
<Forms.Input name="partner_link_url" />
</div>
</div>
<div class="flex flex-col w-full mt-2">
<Forms.Label for="partner_image_url" hint="<?= lang('Podcast.form.partner_image_url_hint') ?>" isOptional="true"><?= lang('Podcast.form.partner_image_url') ?></Forms.Label>
<Forms.Input name="partner_image_url" />
</div>
</fieldset>
</Forms.Section>
<Forms.Section
title="<?= lang('Podcast.form.advanced_section_title') ?>" >

View File

@ -207,35 +207,6 @@
</Forms.Section>
<Forms.Section
title="<?= lang('Podcast.form.monetization_section_title') ?>"
subtitle="<?= lang('Podcast.form.monetization_section_subtitle') ?>" >
<Forms.Field
name="payment_pointer"
label="<?= lang('Podcast.form.payment_pointer') ?>"
value="<?= esc($podcast->payment_pointer) ?>"
hint="<?= lang('Podcast.form.payment_pointer_hint') ?>" />
<fieldset class="flex flex-col items-start p-4 rounded bg-base">
<Heading tagName="legend" class="float-left" size="small"><?= lang('Podcast.form.partnership') ?></Heading>
<div class="flex flex-col w-full clear-left gap-x-2 gap-y-4 md:flex-row">
<div class="flex flex-col flex-shrink w-32">
<Forms.Label for="partner_id" hint="<?= lang('Podcast.form.partner_id_hint') ?>" isOptional="true"><?= lang('Podcast.form.partner_id') ?></Forms.Label>
<Forms.Input name="partner_id" value="<?= esc($podcast->partner_id) ?>" />
</div>
<div class="flex flex-col flex-1">
<Forms.Label for="partner_link_url" hint="<?= lang('Podcast.form.partner_link_url_hint') ?>" isOptional="true"><?= lang('Podcast.form.partner_link_url') ?></Forms.Label>
<Forms.Input name="partner_link_url" value="<?= esc($podcast->partner_link_url) ?>" />
</div>
</div>
<div class="flex flex-col w-full mt-2">
<Forms.Label for="partner_image_url" hint="<?= lang('Podcast.form.partner_image_url_hint') ?>" isOptional="true"><?= lang('Podcast.form.partner_image_url') ?></Forms.Label>
<Forms.Input name="partner_image_url" value="<?= esc($podcast->partner_image_url) ?>" />
</div>
</fieldset>
</Forms.Section>
<Forms.Section
title="<?= lang('Podcast.form.advanced_section_title') ?>"
subtitle="<?= lang('Podcast.form.advanced_section_subtitle') ?>" >

View File

@ -0,0 +1,47 @@
<?= $this->extend('_layout') ?>
<?= $this->section('title') ?>
<?= lang('Podcast.all_podcasts') ?>
<?= $this->endSection() ?>
<?= $this->section('pageTitle') ?>
<?= lang('Podcast.all_podcasts') ?>
<?= $this->endSection() ?>
<?= $this->section('content') ?>
<form id="podcast-edit-form" action="<?= route_to('podcast-monetization-edit', $podcast->id) ?>" method="POST" class="flex flex-col w-full max-w-xl gap-y-6">
<?= csrf_field() ?>
<Forms.Section
title="<?= lang('Podcast.form.monetization_section_title') ?>"
subtitle="<?= lang('Podcast.form.monetization_section_subtitle') ?>" >
<Forms.Field
name="payment_pointer"
label="<?= lang('Podcast.form.payment_pointer') ?>"
value="<?= esc($podcast->payment_pointer) ?>"
hint="<?= lang('Podcast.form.payment_pointer_hint') ?>" />
<fieldset class="flex flex-col items-start p-4 rounded bg-base">
<Heading tagName="legend" class="float-left" size="small"><?= lang('Podcast.form.partnership') ?></Heading>
<div class="flex flex-col w-full clear-left gap-x-2 gap-y-4 md:flex-row">
<div class="flex flex-col flex-shrink w-32">
<Forms.Label for="partner_id" hint="<?= lang('Podcast.form.partner_id_hint') ?>" isOptional="true"><?= lang('Podcast.form.partner_id') ?></Forms.Label>
<Forms.Input name="partner_id" value="<?= esc($podcast->partner_id) ?>" />
</div>
<div class="flex flex-col flex-1">
<Forms.Label for="partner_link_url" hint="<?= lang('Podcast.form.partner_link_url_hint') ?>" isOptional="true"><?= lang('Podcast.form.partner_link_url') ?></Forms.Label>
<Forms.Input name="partner_link_url" value="<?= esc($podcast->partner_link_url) ?>" />
</div>
</div>
<div class="flex flex-col w-full mt-2">
<Forms.Label for="partner_image_url" hint="<?= lang('Podcast.form.partner_image_url_hint') ?>" isOptional="true"><?= lang('Podcast.form.partner_image_url') ?></Forms.Label>
<Forms.Input name="partner_image_url" value="<?= esc($podcast->partner_image_url) ?>" />
</div>
</fieldset>
</Forms.Section>
<Button variant="primary" type="submit" class="self-end"><?= lang('Common.forms.save') ?></Button>
</form>
<?= $this->endSection() ?>

View File

@ -12,6 +12,10 @@
<Button form="platforms-form" variant="primary" type="submit" class="self-end"><?= lang('Platforms.submit') ?></Button>
<?= $this->endSection() ?>
<?= $this->section('subtitle') ?>
<p class="max-w-xl text-skin-muted">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Quod ex corporis sed et tenetur, doloremque nihil autem odio! Similique nemo in est magnam aspernatur temporibus a architecto quod cupiditate vitae!</p>
<?= $this->endSection() ?>
<?= $this->section('content') ?>
<form id="platforms-form" action="<?= route_to('platforms-save', $podcast->id, $platformType) ?>" method="POST" class="flex flex-col max-w-md">