baseline
This commit is contained in:
34
templates/partials/app-flash.phtml
Normal file
34
templates/partials/app-flash.phtml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use MintyPHP\Support\Flash;
|
||||
use MintyPHP\Http\Request;
|
||||
use MintyPHP\Session;
|
||||
|
||||
$messages = Flash::peek(Request::path());
|
||||
if (!$messages) {
|
||||
return;
|
||||
}
|
||||
|
||||
$returnTarget = Request::pathWithQuery();
|
||||
$timeouts = [
|
||||
'success' => 5000,
|
||||
'info' => 6000,
|
||||
'warning' => 7000,
|
||||
'error' => 0,
|
||||
];
|
||||
|
||||
?>
|
||||
<div class="flash-stack">
|
||||
<?php foreach ($messages as $message) : ?>
|
||||
<?php $type = $message['type'] ?? 'info'; ?>
|
||||
<?php $timeout = $timeouts[$type] ?? 5000; ?>
|
||||
<div class="notice" data-variant="<?php e($type); ?>" data-flash-timeout="<?php e($timeout); ?>">
|
||||
<?php e(t($message['message'] ?? '')); ?>
|
||||
<form method="post" action="flash/dismiss/<?php e($message['id'] ?? ''); ?>">
|
||||
<input type="hidden" name="return" value="<?php e($returnTarget); ?>">
|
||||
<button type="submit" class="contrast outline small"><i class="bi bi-x"></i></button>
|
||||
<?php Session::getCsrfInput(); ?>
|
||||
</form>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
Reference in New Issue
Block a user