Commit 3b3c218b authored by Yassine Doghri's avatar Yassine Doghri
Browse files

fix(episode-form): show warning to set `memory_limit`, `upload_max_filesize` & `post_max_size`

remove undefined "my-podcasts" route

closes #5, #86
parent c37a4af2
......@@ -90,10 +90,6 @@ $routes->group(
'as' => 'admin',
]);
$routes->get('my-podcasts', 'Podcast::myPodcasts', [
'as' => 'my-podcasts',
]);
$routes->group('persons', function ($routes) {
$routes->get('/', 'Person', [
'as' => 'person-list',
......
......@@ -111,8 +111,8 @@ class Episode extends BaseController
'enclosure' => 'uploaded[enclosure]|ext_in[enclosure,mp3,m4a]',
'image' =>
'is_image[image]|ext_in[image,jpg,png]|min_dims[image,1400,1400]|is_image_squared[image]',
'transcript' => 'ext_in[transcript,txt,html,srt,json]',
'chapters' => 'ext_in[chapters,json]',
'transcript' => 'ext_in[transcript,txt,html,srt,json]|permit_empty',
'chapters' => 'ext_in[chapters,json]|permit_empty',
];
if (!$this->validate($rules)) {
......@@ -205,8 +205,8 @@ class Episode extends BaseController
'uploaded[enclosure]|ext_in[enclosure,mp3,m4a]|permit_empty',
'image' =>
'is_image[image]|ext_in[image,jpg,png]|min_dims[image,1400,1400]|is_image_squared[image]',
'transcript' => 'ext_in[transcript,txt,html,srt,json]',
'chapters' => 'ext_in[chapters,json]',
'transcript' => 'ext_in[transcript,txt,html,srt,json]|permit_empty',
'chapters' => 'ext_in[chapters,json]|permit_empty',
];
if (!$this->validate($rules)) {
......
......@@ -43,6 +43,8 @@ return [
'not_published' => 'Not published',
],
'form' => [
'warning' =>
'In case of fatal error, try increasing the `memory_limit`, `upload_max_filesize` and `post_max_size` values in your php configuration file then restart your web server.<br />These values must be higher than the audio file you wish to upload.',
'enclosure' => 'Audio file',
'enclosure_hint' => 'Choose an .mp3 or .m4a audio file.',
'info_section_title' => 'Episode info',
......
......@@ -43,6 +43,8 @@ return [
'not_published' => 'Non publié',
],
'form' => [
'warning' =>
'En cas d’erreur fatale, essayez d’augmenter les valeurs de `memory_limit`, `upload_max_filesize` et `post_max_size` dans votre fichier de configuration php puis redémarrez votre serveur web.<br />Les valeurs doivent être plus grandes que le fichier audio que vous souhaitez téléverser.',
'enclosure' => 'Fichier audio',
'enclosure_hint' => 'Sélectionnez un fichier audio .mp3 ou .m4a.',
'info_section_title' => 'Informations épisode',
......
......@@ -18,16 +18,21 @@
<?= csrf_field() ?>
<?= form_hidden('client_timezone', 'UTC') ?>
<div class="inline-flex w-full p-2 mb-4 text-sm font-semibold text-yellow-800 bg-red-100 border border-red-300 rounded" role="alert">
<?= icon('alert', 'mr-2 text-lg flex-shrink-0') .
lang('Episode.form.warning') ?>
</div>
<?= form_section(
lang('Episode.form.info_section_title'),
lang('Episode.form.info_section_subtitle')
lang('Episode.form.info_section_subtitle'),
) ?>
<?= form_label(
lang('Episode.form.enclosure'),
'enclosure',
[],
lang('Episode.form.enclosure_hint')
lang('Episode.form.enclosure_hint'),
) ?>
<?= form_input([
'id' => 'enclosure',
......@@ -43,7 +48,7 @@
'image',
[],
lang('Episode.form.image_hint'),
true
true,
) ?>
<?= form_input([
'id' => 'image',
......@@ -53,14 +58,14 @@
'accept' => '.jpg,.jpeg,.png',
]) ?>
<small class="mb-4 text-gray-600"><?= lang(
'Common.forms.image_size_hint'
'Common.forms.image_size_hint',
) ?></small>
<?= form_label(
lang('Episode.form.title'),
'title',
[],
lang('Episode.form.title_hint')
lang('Episode.form.title_hint'),
) ?>
<?= form_input([
'id' => 'title',
......@@ -75,7 +80,7 @@
lang('Episode.form.slug'),
'slug',
[],
lang('Episode.form.slug_hint')
lang('Episode.form.slug_hint'),
) ?>
<?= form_input([
'id' => 'slug',
......@@ -118,7 +123,7 @@
<?= form_radio(
['id' => 'full', 'name' => 'type', 'class' => 'form-radio-btn'],
'full',
old('type') ? old('type') == 'full' : true
old('type') ? old('type') == 'full' : true,
) ?>
<label for="full" class="inline-flex items-center">
<?= lang('Episode.form.type.full') ?>
......@@ -126,7 +131,7 @@
<?= form_radio(
['id' => 'trailer', 'name' => 'type', 'class' => 'form-radio-btn'],
'trailer',
old('type') ? old('type') == 'trailer' : false
old('type') ? old('type') == 'trailer' : false,
) ?>
<label for="trailer" class="inline-flex items-center">
<?= lang('Episode.form.type.trailer') ?>
......@@ -134,7 +139,7 @@
<?= form_radio(
['id' => 'bonus', 'name' => 'type', 'class' => 'form-radio-btn'],
'bonus',
old('type') ? old('type') == 'bonus' : false
old('type') ? old('type') == 'bonus' : false,
) ?>
<label for="bonus" class="inline-flex items-center">
<?= lang('Episode.form.type.bonus') ?>
......@@ -155,10 +160,10 @@
'undefined',
old('parental_advisory')
? old('parental_advisory') === 'undefined'
: true
: true,
) ?>
<label for="undefined"><?= lang(
'Episode.form.parental_advisory.undefined'
'Episode.form.parental_advisory.undefined',
) ?></label>
<?= form_radio(
[
......@@ -167,10 +172,10 @@
'class' => 'form-radio-btn',
],
'clean',
old('parental_advisory') ? old('parental_advisory') === 'clean' : false
old('parental_advisory') ? old('parental_advisory') === 'clean' : false,
) ?>
<label for="clean"><?= lang(
'Episode.form.parental_advisory.clean'
'Episode.form.parental_advisory.clean',
) ?></label>
<?= form_radio(
[
......@@ -181,10 +186,10 @@
'explicit',
old('parental_advisory')
? old('parental_advisory') === 'explicit'
: false
: false,
) ?>
<label for="explicit"><?= lang(
'Episode.form.parental_advisory.explicit'
'Episode.form.parental_advisory.explicit',
) ?></label>
<?= form_fieldset_close() ?>
......@@ -193,7 +198,7 @@
<?= form_section(
lang('Episode.form.show_notes_section_title'),
lang('Episode.form.show_notes_section_subtitle')
lang('Episode.form.show_notes_section_subtitle'),
) ?>
<div class="mb-4">
......@@ -206,7 +211,7 @@
'required' => 'required',
],
old('description', '', false),
'data-editor="markdown"'
'data-editor="markdown"',
) ?>
</div>
......@@ -215,7 +220,7 @@
lang('Episode.form.description_footer'),
'description_footer',
[],
lang('Episode.form.description_footer_hint')
lang('Episode.form.description_footer_hint'),
) ?>
<?= form_textarea(
[
......@@ -226,9 +231,9 @@
old(
'description_footer',
$podcast->episode_description_footer_markdown ?? '',
false
false,
),
'data-editor="markdown"'
'data-editor="markdown"',
) ?>
</div>
......@@ -236,7 +241,7 @@
<?= form_section(
lang('Episode.form.location_section_title'),
lang('Episode.form.location_section_subtitle')
lang('Episode.form.location_section_subtitle'),
) ?>
<?= form_label(
......@@ -244,7 +249,7 @@
'location_name',
[],
lang('Episode.form.location_name_hint'),
true
true,
) ?>
<?= form_input([
'id' => 'location_name',
......@@ -256,14 +261,14 @@
<?= form_section(
lang('Episode.form.additional_files_section_title'),
lang('Episode.form.additional_files_section_subtitle')
lang('Episode.form.additional_files_section_subtitle'),
) ?>
<?= form_label(
lang('Episode.form.transcript'),
'transcript',
[],
lang('Episode.form.transcript_hint'),
true
true,
) ?>
<?= form_input([
'id' => 'transcript',
......@@ -277,7 +282,7 @@
'chapters',
[],
lang('Episode.form.chapters_hint'),
true
true,
) ?>
<?= form_input([
'id' => 'chapters',
......@@ -290,14 +295,14 @@
<?= form_section(
lang('Episode.form.advanced_section_title'),
lang('Episode.form.advanced_section_subtitle')
lang('Episode.form.advanced_section_subtitle'),
) ?>
<?= form_label(
lang('Episode.form.custom_rss'),
'custom_rss',
[],
lang('Episode.form.custom_rss_hint'),
true
true,
) ?>
<?= form_textarea([
'id' => 'custom_rss',
......@@ -312,14 +317,14 @@
hint_tooltip(lang('Episode.form.block_hint'), 'ml-1'),
['id' => 'block', 'name' => 'block'],
'yes',
old('block', false)
old('block', false),
) ?>
<?= button(
lang('Episode.form.submit_create'),
null,
['variant' => 'primary'],
['type' => 'submit', 'class' => 'self-end']
['type' => 'submit', 'class' => 'self-end'],
) ?>
<?= form_close() ?>
......
......@@ -17,16 +17,21 @@
]) ?>
<?= csrf_field() ?>
<div class="inline-flex w-full p-2 mb-4 text-sm font-semibold text-yellow-800 bg-red-100 border border-red-300 rounded" role="alert">
<?= icon('alert', 'mr-2 text-lg flex-shrink-0') .
lang('Episode.form.warning') ?>
</div>
<?= form_section(
lang('Episode.form.info_section_title'),
lang('Episode.form.info_section_subtitle')
lang('Episode.form.info_section_subtitle'),
) ?>
<?= form_label(
lang('Episode.form.enclosure'),
'enclosure',
[],
lang('Episode.form.enclosure_hint')
lang('Episode.form.enclosure_hint'),
) ?>
<?= form_input([
'id' => 'enclosure',
......@@ -41,7 +46,7 @@
'image',
[],
lang('Episode.form.image_hint'),
true
true,
) ?>
<img
src="<?= $episode->image->thumbnail_url ?>"
......@@ -51,19 +56,20 @@
<?= form_input([
'id' => 'image',
'name' => 'image',
'class' => 'form-input',
'type' => 'file',
'accept' => '.jpg,.jpeg,.png',
]) ?>
<small class="mb-4 text-gray-600"><?= lang(
'Common.forms.image_size_hint'
'Common.forms.image_size_hint',
) ?></small>
<?= form_label(
lang('Episode.form.title'),
'title',
[],
lang('Episode.form.title_hint')
lang('Episode.form.title_hint'),
) ?>
<?= form_input([
'id' => 'title',
......@@ -78,7 +84,7 @@
lang('Episode.form.slug'),
'slug',
[],
lang('Episode.form.slug_hint')
lang('Episode.form.slug_hint'),
) ?>
<?= form_input([
'id' => 'slug',
......@@ -120,7 +126,7 @@
<?= form_radio(
['id' => 'full', 'name' => 'type', 'class' => 'form-radio-btn'],
'full',
old('type') ? old('type') === 'full' : $episode->type === 'full'
old('type') ? old('type') === 'full' : $episode->type === 'full',
) ?>
<label for="full" class="inline-flex items-center">
<?= lang('Episode.form.type.full') ?>
......@@ -128,7 +134,7 @@
<?= form_radio(
['id' => 'trailer', 'name' => 'type', 'class' => 'form-radio-btn'],
'trailer',
old('type') ? old('type') === 'trailer' : $episode->type === 'trailer'
old('type') ? old('type') === 'trailer' : $episode->type === 'trailer',
) ?>
<label for="trailer" class="inline-flex items-center">
<?= lang('Episode.form.type.trailer') ?>
......@@ -136,7 +142,7 @@
<?= form_radio(
['id' => 'bonus', 'name' => 'type', 'class' => 'form-radio-btn'],
'bonus',
old('type') ? old('type') === 'bonus' : $episode->type === 'bonus'
old('type') ? old('type') === 'bonus' : $episode->type === 'bonus',
) ?>
<label for="bonus" class="inline-flex items-center">
<?= lang('Episode.form.type.bonus') ?>
......@@ -157,10 +163,10 @@
'undefined',
old('parental_advisory')
? old('parental_advisory') === 'undefined'
: $episode->parental_advisory === null
: $episode->parental_advisory === null,
) ?>
<label for="undefined"><?= lang(
'Episode.form.parental_advisory.undefined'
'Episode.form.parental_advisory.undefined',
) ?></label>
<?= form_radio(
[
......@@ -171,10 +177,10 @@
'clean',
old('parental_advisory')
? old('parental_advisory') === 'clean'
: $episode->parental_advisory === 'clean'
: $episode->parental_advisory === 'clean',
) ?>
<label for="clean"><?= lang(
'Episode.form.parental_advisory.clean'
'Episode.form.parental_advisory.clean',
) ?></label>
<?= form_radio(
[
......@@ -185,10 +191,10 @@
'explicit',
old('parental_advisory')
? old('parental_advisory') === 'explicit'
: $episode->parental_advisory === 'explicit'
: $episode->parental_advisory === 'explicit',
) ?>
<label for="explicit"><?= lang(
'Episode.form.parental_advisory.explicit'
'Episode.form.parental_advisory.explicit',
) ?></label>
<?= form_fieldset_close() ?>
......@@ -197,7 +203,7 @@
<?= form_section(
lang('Episode.form.show_notes_section_title'),
lang('Episode.form.show_notes_section_subtitle')
lang('Episode.form.show_notes_section_subtitle'),
) ?>
<div class="mb-4">
......@@ -210,7 +216,7 @@
'required' => 'required',
],
old('description', $episode->description_markdown, false),
'data-editor="markdown"'
'data-editor="markdown"',
) ?>
</div>
......@@ -219,7 +225,7 @@
lang('Episode.form.description_footer'),
'description_footer',
[],
lang('Episode.form.description_footer_hint')
lang('Episode.form.description_footer_hint'),
) ?>
<?= form_textarea(
[
......@@ -230,9 +236,9 @@
old(
'description_footer',
$podcast->episode_description_footer_markdown ?? '',
false
false,
),
'data-editor="markdown"'
'data-editor="markdown"',
) ?>
</div>
......@@ -240,7 +246,7 @@
<?= form_section(
lang('Episode.form.location_section_title'),
lang('Episode.form.location_section_subtitle')
lang('Episode.form.location_section_subtitle'),
) ?>
<?= form_label(
......@@ -248,7 +254,7 @@
'location_name',
[],
lang('Episode.form.location_name_hint'),
true
true,
) ?>
<?= form_input([
'id' => 'location_name',
......@@ -264,7 +270,7 @@
lang('Episode.form.additional_files_section_subtitle', [
'podcastNamespaceLink' =>
'“<a href="https://github.com/Podcastindex-org/podcast-namespace" target="_blank" rel="noreferrer noopener" style="text-decoration: underline;">podcast namespace</a>”',
])
]),
) ?>
<div class="flex flex-col flex-1">
<?= form_label(
......@@ -272,7 +278,7 @@
'transcript',
[],
lang('Episode.form.transcript_hint'),
true
true,
) ?>
<?php if ($episode->transcript): ?>
<div class="flex justify-between">
......@@ -283,7 +289,7 @@
'class' => 'inline-flex items-center text-xs',
'target' => '_blank',
'rel' => 'noreferrer noopener',
]
],
) .
anchor(
route_to('transcript-delete', $podcast->id, $episode->id),
......@@ -294,7 +300,7 @@
'data-toggle' => 'tooltip',
'data-placement' => 'bottom',
'title' => lang('Episode.form.transcript_delete'),
]
],
) ?>
</div>
<?php endif; ?>
......@@ -312,7 +318,7 @@
'chapters',
[],
lang('Episode.form.chapters_hint'),
true
true,
) ?>
<?php if ($episode->chapters): ?>
<div class="flex justify-between">
......@@ -323,7 +329,7 @@
'class' => 'inline-flex items-center text-xs',
'target' => '_blank',
'rel' => 'noreferrer noopener',
]
],
) .
anchor(
route_to('chapters-delete', $podcast->id, $episode->id),
......@@ -334,7 +340,7 @@
'data-toggle' => 'tooltip',
'data-placement' => 'bottom',
'title' => lang('Episode.form.chapters_delete'),
]
],
) ?>
</div>
<?php endif; ?>
......@@ -350,14 +356,14 @@
<?= form_section(
lang('Episode.form.advanced_section_title'),
lang('Episode.form.advanced_section_subtitle')
lang('Episode.form.advanced_section_subtitle'),
) ?>
<?= form_label(
lang('Episode.form.custom_rss'),
'custom_rss',
[],
lang('Episode.form.custom_rss_hint'),
true
true,
) ?>
<?= form_textarea([
'id' => 'custom_rss',
......@@ -372,14 +378,14 @@
hint_tooltip(lang('Episode.form.block_hint'), 'ml-1'),
['id' => 'block', 'name' => 'block'],
'yes',
old('block', $episode->is_blocked)
old('block', $episode->is_blocked),
) ?>
<?= button(
lang('Episode.form.submit_edit'),
null,
['variant' => 'primary'],
['type' => 'submit', 'class' => 'self-end']
['type' => 'submit', 'class' => 'self-end'],
) ?>
<?= form_close() ?>
......
......@@ -16,6 +16,10 @@
]) ?>
<?= csrf_field() ?>
<div class="inline-flex w-full p-2 mb-6 text-sm font-semibold text-yellow-800 bg-red-100 border border-red-300 rounded" role="alert">
<?= icon('alert', 'mr-2 text-lg flex-shrink-0') .
lang('PodcastImport.warning') ?>
</div>
<?= form_section(
lang('PodcastImport.old_podcast_section_title'),
......@@ -215,11 +219,6 @@
<?= form_section_close() ?>
<div class="inline-flex w-full p-2 mb-4 text-sm font-semibold text-yellow-800 bg-red-100 border border-red-300 rounded" role="alert">
<?= icon('alert', 'mr-2 text-lg flex-shrink-0') .
lang('PodcastImport.warning') ?>
</div>
<?= button(
lang('PodcastImport.submit'),
null,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment