refactor: harmonize redirects after submitting forms

go back to form after submitting an edit form
This commit is contained in:
Yassine Doghri 2022-01-05 14:58:53 +00:00
parent 6e9451a110
commit d0cb964b0f
36 changed files with 179 additions and 57 deletions

View File

@ -21,7 +21,7 @@ class DropdownMenu extends Component
public function setItems(string $value): void public function setItems(string $value): void
{ {
$this->items = json_decode(html_entity_decode($value), true); $this->items = json_decode(htmlspecialchars_decode($value), true);
} }
public function render(): string public function render(): string
@ -39,7 +39,7 @@ class DropdownMenu extends Component
]); ]);
break; break;
case 'html': case 'html':
$menuItems .= html_entity_decode($item['content']); $menuItems .= htmlspecialchars_decode($item['content']);
break; break;
case 'separator': case 'separator':
$menuItems .= '<hr class="my-2 border border-subtle">'; $menuItems .= '<hr class="my-2 border border-subtle">';

View File

@ -13,7 +13,10 @@ class MarkdownEditor extends FormComponent
$this->attributes['class'] = 'bg-elevated border-none focus:border-none focus:outline-none focus:ring-0 w-full h-full'; $this->attributes['class'] = 'bg-elevated border-none focus:border-none focus:outline-none focus:ring-0 w-full h-full';
$this->attributes['rows'] = 6; $this->attributes['rows'] = 6;
$textarea = form_textarea($this->attributes, old($this->name, html_entity_decode($this->value), false)); // dd(htmlspecialchars_decode($this->value));
$value = htmlspecialchars_decode($this->value);
$textarea = form_textarea($this->attributes, old($this->name, $value, false));
$icons = [ $icons = [
'heading' => icon('heading'), 'heading' => icon('heading'),
'bold' => icon('bold'), 'bold' => icon('bold'),

View File

@ -18,12 +18,12 @@ class MultiSelect extends FormComponent
public function setOptions(string $value): void public function setOptions(string $value): void
{ {
$this->options = json_decode(html_entity_decode($value), true); $this->options = json_decode(htmlspecialchars_decode($value), true);
} }
public function setSelected(string $selected): void public function setSelected(string $selected): void
{ {
$this->selected = json_decode($selected); $this->selected = json_decode(htmlspecialchars_decode($selected), true);
} }
public function render(): string public function render(): string

View File

@ -15,7 +15,7 @@ class Select extends FormComponent
public function setOptions(string $value): void public function setOptions(string $value): void
{ {
$this->options = json_decode(html_entity_decode($value), true); $this->options = json_decode(htmlspecialchars_decode($value), true);
} }
public function render(): string public function render(): string

View File

@ -9,7 +9,7 @@ class Textarea extends FormComponent
public function setValue(?string $value): void public function setValue(?string $value): void
{ {
if ($value) { if ($value) {
$this->value = html_entity_decode($value); $this->value = htmlspecialchars_decode($value);
} }
} }

View File

@ -21,7 +21,7 @@
Sorry! Cannot seem to find the page you were looking for. Sorry! Cannot seem to find the page you were looking for.
<?php endif; ?> <?php endif; ?>
</p> </p>
<button class="inline-flex items-center justify-center px-3 py-1 text-sm font-semibold rounded-full shadow-xs text-accent-contrast focus:ring-accent md:px-4 md:py-2 md:text-base bg-accent-base hover:bg-accent-hover"><?= lang('Common.go_back') ?></button> <a href="<?= previous_url() ?>" class="inline-flex items-center justify-center px-3 py-1 text-sm font-semibold rounded-full shadow-xs text-accent-contrast focus:ring-accent md:px-4 md:py-2 md:text-base bg-accent-base hover:bg-accent-hover"><?= lang('Common.go_back') ?></a>
</body> </body>
</html> </html>

View File

@ -166,7 +166,10 @@ class ContributorController extends BaseController
(int) $this->request->getPost('role'), (int) $this->request->getPost('role'),
); );
return redirect()->route('contributor-list', [$this->podcast->id]); return redirect()->route('contributor-edit', [$this->podcast->id, $this->user->id])->with(
'message',
lang('Contributor.messages.editSuccess')
);
} }
public function remove(): RedirectResponse public function remove(): RedirectResponse
@ -174,7 +177,7 @@ class ContributorController extends BaseController
if ($this->podcast->created_by === $this->user->id) { if ($this->podcast->created_by === $this->user->id) {
return redirect() return redirect()
->back() ->back()
->with('errors', [lang('Contributor.messages.removeOwnerContributorError')]); ->with('errors', [lang('Contributor.messages.removeOwnerError')]);
} }
$podcastModel = new PodcastModel(); $podcastModel = new PodcastModel();
@ -187,10 +190,10 @@ class ContributorController extends BaseController
} }
return redirect() return redirect()
->back() ->route('contributor-list', [$this->podcast->id])
->with( ->with(
'message', 'message',
lang('Contributor.messages.removeContributorSuccess', [ lang('Contributor.messages.removeSuccess', [
'username' => $this->user->username, 'username' => $this->user->username,
'podcastTitle' => $this->podcast->title, 'podcastTitle' => $this->podcast->title,
]), ]),

View File

@ -205,7 +205,10 @@ class EpisodeController extends BaseController
$db->transComplete(); $db->transComplete();
return redirect()->route('episode-view', [$this->podcast->id, $newEpisodeId]); return redirect()->route('episode-view', [$this->podcast->id, $newEpisodeId])->with(
'message',
lang('Episode.messages.createSuccess')
);
} }
public function edit(): string public function edit(): string
@ -334,11 +337,18 @@ class EpisodeController extends BaseController
$db->transComplete(); $db->transComplete();
return redirect()->route('episode-view', [$this->podcast->id, $this->episode->id]); return redirect()->route('episode-edit', [$this->podcast->id, $this->episode->id])->with(
'message',
lang('Episode.messages.editSuccess')
);
} }
public function transcriptDelete(): RedirectResponse public function transcriptDelete(): RedirectResponse
{ {
if ($this->episode->transcript === null) {
return redirect()->back();
}
$mediaModel = new MediaModel(); $mediaModel = new MediaModel();
if (! $mediaModel->deleteMedia($this->episode->transcript)) { if (! $mediaModel->deleteMedia($this->episode->transcript)) {
return redirect() return redirect()
@ -352,6 +362,10 @@ class EpisodeController extends BaseController
public function chaptersDelete(): RedirectResponse public function chaptersDelete(): RedirectResponse
{ {
if ($this->episode->chapters === null) {
return redirect()->back();
}
$mediaModel = new MediaModel(); $mediaModel = new MediaModel();
if (! $mediaModel->deleteMedia($this->episode->chapters)) { if (! $mediaModel->deleteMedia($this->episode->chapters)) {
return redirect() return redirect()
@ -699,16 +713,18 @@ class EpisodeController extends BaseController
(new PostModel())->removePost($post); (new PostModel())->removePost($post);
} }
// set episode published_at to null to unpublish before deletion
$this->episode->published_at = null;
$episodeModel = new EpisodeModel(); $episodeModel = new EpisodeModel();
if (! $episodeModel->update($this->episode->id, $this->episode)) { if ($this->episode->published_at !== null) {
$db->transRollback(); // if episode is published, set episode published_at to null to unpublish before deletion
return redirect() $this->episode->published_at = null;
->back()
->withInput() if (! $episodeModel->update($this->episode->id, $this->episode)) {
->with('errors', $episodeModel->errors()); $db->transRollback();
return redirect()
->back()
->withInput()
->with('errors', $episodeModel->errors());
}
} }
$episodeModel->delete($this->episode->id); $episodeModel->delete($this->episode->id);

View File

@ -106,7 +106,7 @@ class PageController extends BaseController
->with('errors', $pageModel->errors()); ->with('errors', $pageModel->errors());
} }
return redirect()->route('page-list'); return redirect()->route('page-edit', [$this->page->id])->with('message', lang('Page.messages.editSuccess'));
} }
public function delete(): RedirectResponse public function delete(): RedirectResponse

View File

@ -99,7 +99,8 @@ class PersonController extends BaseController
$db->transComplete(); $db->transComplete();
return redirect()->route('person-list'); return redirect()->route('person-list')
->with('message', lang('Person.messages.createSuccess'));
} }
public function edit(): string public function edit(): string
@ -145,13 +146,17 @@ class PersonController extends BaseController
->with('errors', $personModel->errors()); ->with('errors', $personModel->errors());
} }
return redirect()->route('person-view', [$this->person->id]); return redirect()->route('person-edit', [$this->person->id])->with(
'message',
lang('Person.messages.editSuccess')
);
} }
public function delete(): RedirectResponse public function delete(): RedirectResponse
{ {
(new PersonModel())->delete($this->person->id); (new PersonModel())->delete($this->person->id);
return redirect()->route('person-list'); return redirect()->route('person-list')
->with('message', lang('Person.messages.deleteSuccess'));
} }
} }

View File

@ -255,7 +255,10 @@ class PodcastController extends BaseController
$db->transComplete(); $db->transComplete();
return redirect()->route('podcast-view', [$newPodcastId]); return redirect()->route('podcast-view', [$newPodcastId])->with(
'message',
lang('Podcast.messages.createSuccess')
);
} }
public function edit(): string public function edit(): string
@ -354,7 +357,10 @@ class PodcastController extends BaseController
$db->transComplete(); $db->transComplete();
return redirect()->back(); return redirect()->route('podcast-edit', [$this->podcast->id])->with(
'message',
lang('Podcast.messages.editSuccess')
);
} }
public function deleteBanner(): RedirectResponse public function deleteBanner(): RedirectResponse

View File

@ -134,7 +134,10 @@ class SoundbiteController extends BaseController
->with('errors', $clipModel->errors()); ->with('errors', $clipModel->errors());
} }
return redirect()->route('soundbites-list', [$this->podcast->id, $this->episode->id]); return redirect()->route('soundbites-list', [$this->podcast->id, $this->episode->id])->with(
'message',
lang('Soundbite.messages.createSuccess')
);
} }
public function delete(string $soundbiteId): RedirectResponse public function delete(string $soundbiteId): RedirectResponse
@ -158,6 +161,9 @@ class SoundbiteController extends BaseController
} }
} }
return redirect()->route('soundbites-list', [$this->podcast->id, $this->episode->id]); return redirect()->route('soundbites-list', [$this->podcast->id, $this->episode->id])->with(
'message',
lang('Soundbite.messages.deleteSuccess')
);
} }
} }

View File

@ -32,8 +32,8 @@ return [
'podcast_admin' => 'Podcast admin', 'podcast_admin' => 'Podcast admin',
], ],
'messages' => [ 'messages' => [
'removeOwnerContributorError' => "You can't remove the podcast owner!", 'removeOwnerError' => "You can't remove the podcast owner!",
'removeContributorSuccess' => 'removeSuccess' =>
'You have successfully removed {username} from {podcastTitle}', 'You have successfully removed {username} from {podcastTitle}',
'alreadyAddedError' => 'alreadyAddedError' =>
"The contributor you're trying to add has already been added!", "The contributor you're trying to add has already been added!",

View File

@ -43,6 +43,10 @@ return [
'comments' => 'Comments', 'comments' => 'Comments',
'actions' => 'Actions', 'actions' => 'Actions',
], ],
'messages' => [
'createSuccess' => 'Episode has been successfully created!',
'editSuccess' => 'Episode has been successfully updated!',
],
'form' => [ 'form' => [
'warning' => '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.', '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.',

View File

@ -9,6 +9,12 @@ declare(strict_types=1);
*/ */
return [ return [
'messages' => [
'blockActorSuccess' => '{actor} has been blocked!',
'unblockActorSuccess' => 'Actor has been unblocked!',
'blockDomainSuccess' => '{domain} has been blocked!',
'unblockDomainSuccess' => '{domain} has been unblocked!',
],
'blocked_actors' => 'Blocked accounts', 'blocked_actors' => 'Blocked accounts',
'blocked_domains' => 'Blocked domains', 'blocked_domains' => 'Blocked domains',
'block_lists_form' => [ 'block_lists_form' => [

View File

@ -25,5 +25,6 @@ return [
], ],
'messages' => [ 'messages' => [
'createSuccess' => 'The page “{pageTitle}” was created successfully!', 'createSuccess' => 'The page “{pageTitle}” was created successfully!',
'editSuccess' => 'The page was successfully updated!',
], ],
]; ];

View File

@ -16,6 +16,11 @@ return [
'view' => 'View person', 'view' => 'View person',
'edit' => 'Edit person', 'edit' => 'Edit person',
'delete' => 'Delete person', 'delete' => 'Delete person',
'messages' => [
'createSuccess' => 'Person has been successfully created!',
'editSuccess' => 'Person has been successfully updated!',
'deleteSuccess' => 'Person has been removed!',
],
'form' => [ 'form' => [
'avatar' => 'Avatar', 'avatar' => 'Avatar',
'avatar_size_hint' => 'avatar_size_hint' =>

View File

@ -22,6 +22,11 @@ return [
'go_to_page' => 'Go to page', 'go_to_page' => 'Go to page',
'latest_episodes' => 'Latest episodes', 'latest_episodes' => 'Latest episodes',
'see_all_episodes' => 'See all episodes', 'see_all_episodes' => 'See all episodes',
'messages' => [
'createSuccess' => 'Podcast has been successfully created!',
'editSuccess' => 'Podcast has been successfully updated!',
'importSuccess' => 'Podcast has been successfully imported!',
],
'form' => [ 'form' => [
'identity_section_title' => 'Podcast identity', 'identity_section_title' => 'Podcast identity',
'identity_section_subtitle' => 'These fields allow you to get noticed.', 'identity_section_subtitle' => 'These fields allow you to get noticed.',

View File

@ -13,6 +13,10 @@ return [
'title' => 'Soundbites', 'title' => 'Soundbites',
'soundbite' => 'Soundbite', 'soundbite' => 'Soundbite',
], ],
'messages' => [
'createSuccess' => 'Soundbite has been successfully created!',
'deleteSuccess' => 'Soundbite has been successfully removed!',
],
'form' => [ 'form' => [
'title' => 'New soundbite', 'title' => 'New soundbite',
'soundbite_title' => 'Soundbite title', 'soundbite_title' => 'Soundbite title',

View File

@ -34,6 +34,10 @@ return [
'retry' => 'Retry clip generation', 'retry' => 'Retry clip generation',
'delete' => 'Delete clip', 'delete' => 'Delete clip',
'logs' => 'Job logs', 'logs' => 'Job logs',
'messages' => [
'createSuccess' => 'Video clip has been successfully created!',
'deleteSuccess' => 'Video clip has been successfully removed!',
],
'form' => [ 'form' => [
'title' => 'New video clip', 'title' => 'New video clip',
'params_section_title' => 'Video clip parameters', 'params_section_title' => 'Video clip parameters',

View File

@ -32,9 +32,9 @@ return [
'podcast_admin' => 'Administrateur de Podcasts', 'podcast_admin' => 'Administrateur de Podcasts',
], ],
'messages' => [ 'messages' => [
'removeOwnerContributorError' => 'removeOwnerError' =>
'Vous ne pouvez pas retirer le propriétaire du podcast!', 'Vous ne pouvez pas retirer le propriétaire du podcast!',
'removeContributorSuccess' => 'removeSuccess' =>
'Vous avez retiré {username} de {podcastTitle}', 'Vous avez retiré {username} de {podcastTitle}',
'alreadyAddedError' => 'alreadyAddedError' =>
'Le contributeur que vous essayez dajouter est déjà présent.', 'Le contributeur que vous essayez dajouter est déjà présent.',

View File

@ -44,6 +44,10 @@ return [
'comments' => 'Commentaires', 'comments' => 'Commentaires',
'actions' => 'Actions', 'actions' => 'Actions',
], ],
'messages' => [
'createSuccess' => 'Lépisode a été créé avec succès!',
'editSuccess' => 'Lépisode a bien été mis à jour!',
],
'form' => [ 'form' => [
'warning' => 'warning' =>
'En cas derreur fatale, essayez daugmenter 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.', 'En cas derreur fatale, essayez daugmenter 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.',

View File

@ -9,6 +9,12 @@ declare(strict_types=1);
*/ */
return [ return [
'messages' => [
'blockActorSuccess' => '{actor} a été bloqué!',
'unblockActorSuccess' => 'Lutilisateur a été débloqué!',
'blockDomainSuccess' => '{domain} a été bloqué!',
'unblockDomainSuccess' => '{domain} a été débloqué!',
],
'block_lists' => 'Listes de blocage', 'block_lists' => 'Listes de blocage',
'block_lists_form' => [ 'block_lists_form' => [
'blocked_users' => 'Utilisateurs bloqués', 'blocked_users' => 'Utilisateurs bloqués',

View File

@ -24,6 +24,7 @@ return [
'submit_edit' => 'Enregistrer', 'submit_edit' => 'Enregistrer',
], ],
'messages' => [ 'messages' => [
'createSuccess' => 'La page {pageTitle} a été créée avec succès!', 'createSuccess' => 'La page “{pageTitle}” a été créée avec succès!',
'editSuccess' => 'La page a bien été mise à jour!',
], ],
]; ];

View File

@ -16,6 +16,11 @@ return [
'view' => 'Voir lintervenant', 'view' => 'Voir lintervenant',
'edit' => 'Modifier lintervenant', 'edit' => 'Modifier lintervenant',
'delete' => 'Supprimer lintervenant', 'delete' => 'Supprimer lintervenant',
'messages' => [
'createSuccess' => 'Lintervenant a été créé avec succès!',
'editSuccess' => 'Lintervenant a bien été mis à jour!',
'deleteSuccess' => 'Lintervenant a bien été retiré!',
],
'form' => [ 'form' => [
'avatar' => 'Avatar', 'avatar' => 'Avatar',
'avatar_size_hint' => 'avatar_size_hint' =>

View File

@ -22,6 +22,11 @@ return [
'go_to_page' => 'Aller à la page', 'go_to_page' => 'Aller à la page',
'latest_episodes' => 'Derniers épisodes', 'latest_episodes' => 'Derniers épisodes',
'see_all_episodes' => 'Voir tous les épisodes', 'see_all_episodes' => 'Voir tous les épisodes',
'messages' => [
'createSuccess' => 'Le podcast a été créé avec succès!',
'editSuccess' => 'Le podcast a bien été mis à jour!',
'importSuccess' => 'Le podcast a été importé avec succès!',
],
'form' => [ 'form' => [
'identity_section_title' => 'Informations sur le Podcast', 'identity_section_title' => 'Informations sur le Podcast',
'identity_section_subtitle' => 'identity_section_subtitle' =>

View File

@ -13,6 +13,10 @@ return [
'title' => 'Extraits sonores', 'title' => 'Extraits sonores',
'soundbite' => 'Extrait sonore', 'soundbite' => 'Extrait sonore',
], ],
'messages' => [
'createSuccess' => 'Lextrait sonore a été créé avec succès!',
'deleteSuccess' => 'Lextrait sonore a bien été supprimé!',
],
'form' => [ 'form' => [
'title' => 'Nouvel extrait sonore', 'title' => 'Nouvel extrait sonore',
'soundbite_title' => 'Titre de lextrait', 'soundbite_title' => 'Titre de lextrait',

View File

@ -34,6 +34,10 @@ return [
'retry' => 'Relancer la génération de lextrait', 'retry' => 'Relancer la génération de lextrait',
'delete' => 'Supprimer lextrait', 'delete' => 'Supprimer lextrait',
'logs' => 'Historique dexécution', 'logs' => 'Historique dexécution',
'messages' => [
'createSuccess' => 'Lextrait vidéo a été créé avec succès!',
'deleteSuccess' => 'Lextrait vidéo a bien été supprimé!',
],
'form' => [ 'form' => [
'title' => 'Nouvel extrait vidéo', 'title' => 'Nouvel extrait vidéo',
'params_section_title' => 'Paramètres de lextrait vidéo', 'params_section_title' => 'Paramètres de lextrait vidéo',

View File

@ -42,14 +42,17 @@ class BlockController extends Controller
return redirect() return redirect()
->back() ->back()
->withInput() ->withInput()
->with('error', 'Actor not found.'); ->with('error', lang('Fediverse.messages.actorNotFound'));
} }
model('ActorModel') model('ActorModel')
->blockActor($actor->id); ->blockActor($actor->id);
} }
return redirect()->back(); return redirect()->back()
->with('message', lang('Fediverse.messages.blockActorSuccess', [
'actor' => $handle,
]));
} }
public function attemptUnblockActor(): RedirectResponse public function attemptUnblockActor(): RedirectResponse
@ -68,7 +71,8 @@ class BlockController extends Controller
model('ActorModel') model('ActorModel')
->unblockActor((int) $this->request->getPost('actor_id')); ->unblockActor((int) $this->request->getPost('actor_id'));
return redirect()->back(); return redirect()->back()
->with('message', lang('Fediverse.messages.unblockActorSuccess'));
} }
public function attemptBlockDomain(): RedirectResponse public function attemptBlockDomain(): RedirectResponse
@ -84,10 +88,14 @@ class BlockController extends Controller
->with('errors', $this->validator->getErrors()); ->with('errors', $this->validator->getErrors());
} }
$domain = $this->request->getPost('domain');
model('BlockedDomainModel') model('BlockedDomainModel')
->blockDomain($this->request->getPost('domain')); ->blockDomain($domain);
return redirect()->back(); return redirect()->back()
->with('message', lang('Fediverse.messages.blockDomainSuccess', [
'domain' => $domain,
]));
} }
public function attemptUnblockDomain(): RedirectResponse public function attemptUnblockDomain(): RedirectResponse
@ -103,9 +111,13 @@ class BlockController extends Controller
->with('errors', $this->validator->getErrors()); ->with('errors', $this->validator->getErrors());
} }
$domain = $this->request->getPost('domain');
model('BlockedDomainModel') model('BlockedDomainModel')
->unblockDomain($this->request->getPost('domain')); ->unblockDomain($domain);
return redirect()->back(); return redirect()->back()
->with('message', lang('Fediverse.messages.unblockDomainSuccess', [
'domain' => $domain,
]));
} }
} }

View File

@ -124,12 +124,13 @@ class PostController extends Controller
'published_at' => Time::now(), 'published_at' => Time::now(),
]); ]);
if (! model('PostModel')->addPost($newPost)) { $postModel = model('PostModel');
if (! $postModel->addPost($newPost)) {
return redirect() return redirect()
->back() ->back()
->withInput() ->withInput()
// TODO: translate // TODO: translate
->with('error', "Couldn't create Post"); ->with('error', $postModel->errors());
} }
// Post without preview card has been successfully created // Post without preview card has been successfully created

View File

@ -34,8 +34,13 @@
], ],
[ [
'type' => 'link', 'type' => 'link',
'title' => lang('Episode.soundbites'), 'title' => lang('VideoClip.list.title'),
'uri' => route_to('soundbites-edit', $episode->podcast->id, $episode->id), 'uri' => route_to('video-clips-list', $episode->podcast->id, $episode->id),
],
[
'type' => 'link',
'title' => lang('Soundbite.list.title'),
'uri' => route_to('soundbites-list', $episode->podcast->id, $episode->id),
], ],
[ [
'type' => 'separator', 'type' => 'separator',

View File

@ -99,8 +99,13 @@
], ],
[ [
'type' => 'link', 'type' => 'link',
'title' => lang('Episode.soundbites'), 'title' => lang('VideoClip.list.title'),
'uri' => route_to('soundbites-edit', $podcast->id, $episode->id), 'uri' => route_to('video-clips-list', $episode->podcast->id, $episode->id),
],
[
'type' => 'link',
'title' => lang('Soundbite.list.title'),
'uri' => route_to('soundbites-list', $podcast->id, $episode->id),
], ],
[ [
'type' => 'separator', 'type' => 'separator',

View File

@ -28,8 +28,8 @@
name="persons[]" name="persons[]"
label="<?= lang('Person.episode_form.persons') ?>" label="<?= lang('Person.episode_form.persons') ?>"
hint="<?= lang('Person.episode_form.persons_hint') ?>" hint="<?= lang('Person.episode_form.persons_hint') ?>"
options="<?= htmlspecialchars(json_encode($personOptions)) ?>" options="<?= esc(json_encode($personOptions)) ?>"
selected="<?= htmlspecialchars(json_encode(old('persons', []))) ?>" selected="<?= esc(json_encode(old('persons', []))) ?>"
required="true" required="true"
/> />
@ -39,8 +39,8 @@
name="roles[]" name="roles[]"
label="<?= lang('Person.episode_form.roles') ?>" label="<?= lang('Person.episode_form.roles') ?>"
hint="<?= lang('Person.episode_form.roles_hint') ?>" hint="<?= lang('Person.episode_form.roles_hint') ?>"
options="<?= htmlspecialchars(json_encode($taxonomyOptions)) ?>" options="<?= esc(json_encode($taxonomyOptions)) ?>"
selected="<?= htmlspecialchars(json_encode(old('roles', []))) ?>" selected="<?= esc(json_encode(old('roles', []))) ?>"
required="true" required="true"
/> />

View File

@ -34,7 +34,8 @@
value="<?= $person->unique_name ?>" value="<?= $person->unique_name ?>"
label="<?= lang('Person.form.unique_name') ?>" label="<?= lang('Person.form.unique_name') ?>"
hint="<?= lang('Person.form.unique_name_hint') ?>" hint="<?= lang('Person.form.unique_name_hint') ?>"
required="true" /> required="true"
data-slugify="slug" />
<Forms.Field <Forms.Field
name="information_url" name="information_url"

View File

@ -112,8 +112,8 @@
as="MultiSelect" as="MultiSelect"
name="other_categories[]" name="other_categories[]"
label="<?= lang('Podcast.form.other_categories') ?>" label="<?= lang('Podcast.form.other_categories') ?>"
selected="<?= json_encode($podcast->other_categories_ids) ?>"
data-max-item-count="2" data-max-item-count="2"
selected="<?= esc(json_encode($podcast->other_categories_ids)) ?>"
options="<?= esc(json_encode($categoryOptions)) ?>" /> options="<?= esc(json_encode($categoryOptions)) ?>" />
<fieldset class="mb-4"> <fieldset class="mb-4">

View File

@ -19,6 +19,7 @@
<?= csrf_field() ?> <?= csrf_field() ?>
<Forms.Field <Forms.Field
as="MultiSelect"
id="roles" id="roles"
name="roles[]" name="roles[]"
label="<?= lang('User.form.roles') ?>" label="<?= lang('User.form.roles') ?>"
@ -26,7 +27,7 @@
options="<?= esc(json_encode($roleOptions)) ?>" options="<?= esc(json_encode($roleOptions)) ?>"
selected="<?= esc(json_encode($user->roles)) ?>" /> selected="<?= esc(json_encode($user->roles)) ?>" />
<Button variant="primary" type="submit" class="self-end"><?= lang('User.form.submit_edit') ?></Button> <Button variant="primary" type="submit" class="self-end mt-4"><?= lang('User.form.submit_edit') ?></Button>
</form> </form>