mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix popup toast messages (Remove Flasher) (#16090)
* Remove flasher Just use a bit of custom code to interface with toastr js This is able to retain our custom theme and work properly * Fix style issues * Missed reference rename * Remove test code :) * Fix a missed rename * Fix one more missed reference * Fix typo
This commit is contained in:
36
app/View/Components/Toast.php
Normal file
36
app/View/Components/Toast.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Session\SessionManager;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Toast extends Component
|
||||
{
|
||||
public array $purifier_config = [
|
||||
'HTML.Allowed' => 'a[href],b,i,ul,ol,li,h1,h2,h3,h4,br,p,pre',
|
||||
'URI.DisableExternal' => true,
|
||||
];
|
||||
public ?array $toasts;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(Request $request, SessionManager $session)
|
||||
{
|
||||
$this->purifier_config['URI.Host'] = $request->getHttpHost();
|
||||
$this->toasts = $session->get('toasts');
|
||||
$session->forget('toasts'); // to ward againsts double toasts
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.toast');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user