mirror of
https://code.castopod.org/adaures/castopod
synced 2025-06-06 18:31:05 +00:00
fix(install): set message block on forms to show error messages
fixes #157
This commit is contained in:
parent
b7f285e4e2
commit
3a0a20d59c
@ -30,6 +30,8 @@ class Alert extends Component
|
|||||||
$title = $this->title === null ? '' : '<div class="font-semibold">' . $this->title . '</div>';
|
$title = $this->title === null ? '' : '<div class="font-semibold">' . $this->title . '</div>';
|
||||||
$class = 'inline-flex w-full p-2 text-sm border rounded ' . $variantClasses[$this->variant] . ' ' . $this->class;
|
$class = 'inline-flex w-full p-2 text-sm border rounded ' . $variantClasses[$this->variant] . ' ' . $this->class;
|
||||||
|
|
||||||
|
unset($this->attributes['slot']);
|
||||||
|
unset($this->attributes['variant']);
|
||||||
$attributes = stringify_attributes($this->attributes);
|
$attributes = stringify_attributes($this->attributes);
|
||||||
|
|
||||||
return <<<HTML
|
return <<<HTML
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<main class="container flex flex-col items-center justify-center flex-1 px-4 py-10 mx-auto">
|
<main class="container flex flex-col items-center justify-center flex-1 px-4 py-10 mx-auto">
|
||||||
<!-- view('_message_block') -->
|
<?= view('_message_block') ?>
|
||||||
<?= $this->renderSection('content') ?>
|
<?= $this->renderSection('content') ?>
|
||||||
</main>
|
</main>
|
||||||
<footer class="container px-2 py-4 mx-auto text-sm text-right border-t border-subtle">
|
<footer class="container px-2 py-4 mx-auto text-sm text-right border-t border-subtle">
|
||||||
|
20
themes/cp_install/_message_block.php
Normal file
20
themes/cp_install/_message_block.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
if (session()->has('message')): ?>
|
||||||
|
<Alert variant="success" class="max-w-sm mb-4"><?= session('message') ?></Alert>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (session()->has('error')): ?>
|
||||||
|
<Alert variant="danger" class="max-w-sm mb-4"><?= session('error') ?></Alert>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (session()->has('errors')): ?>
|
||||||
|
<Alert variant="danger" class="max-w-sm mb-4">
|
||||||
|
<ul>
|
||||||
|
<?php foreach (session('errors') as $error): ?>
|
||||||
|
<li><?= $error ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
</Alert>
|
||||||
|
<?php endif;
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user