add global flash-message

This commit is contained in:
Paul Spenke
2023-06-30 07:20:24 +08:00
parent 65f93ae730
commit 0fb1038202
4 changed files with 55 additions and 79 deletions
@@ -2,6 +2,18 @@
<div class="text-center text-3xl font-bold mb-8 mt-2"> <div class="text-center text-3xl font-bold mb-8 mt-2">
<?= phpb_e($tabs[$activeSlug]['title']) ?> <?= phpb_e($tabs[$activeSlug]['title']) ?>
</div> </div>
<?php
if (phpb_flash('message')):
?>
<div class="hidden alert-success alert-error"></div>
<div class="alert alert-<?= phpb_flash('message-type') ?> mb-6">
<?= phpb_flash('message-type') === 'success' ? '<i class="text-xl ph-duotone ph-info"></i>' : '' ?>
<?= phpb_flash('message-type') === 'error' ? '<i class="text-xl ph-duotone ph-warning-circle"></i>' : '' ?>
<span><?= phpb_flash('message') ?></span>
</div>
<?php
endif;
?>
<div class=""> <div class="">
<?php <?php
include $tabs[$activeSlug]['include']; include $tabs[$activeSlug]['include'];
@@ -11,18 +11,6 @@ $pages = $pageRepository->getAll();
<div class="main-spacing" > <div class="main-spacing" >
<?php
if (phpb_flash('message')):
?>
<div class="hidden alert-success"></div>
<div class="alert alert-<?= phpb_flash('message-type') ?> mb-6">
<i class="text-xl ph-duotone ph-info"></i>
<span><?= phpb_flash('message') ?></span>
</div>
<?php
endif;
?>
<div x-data="{menus: <?= phpb_e($menusJson) ?>, pages: <?= phpb_e($menuPagesJson) ?>}" class="flex flex-col gap-12"> <div x-data="{menus: <?= phpb_e($menusJson) ?>, pages: <?= phpb_e($menuPagesJson) ?>}" class="flex flex-col gap-12">
<template x-for="menu in menus"> <template x-for="menu in menus">
<div class=""> <div class="">
@@ -1,62 +1,50 @@
<table class="table table-zebra w-full">
<thead>
<tr>
<th class="w-5">ID</th>
<th><?= phpb_trans('website-manager.name') ?></th>
<th><?= phpb_trans('website-manager.route') ?></th>
<th class="w-44"><?= phpb_trans('website-manager.actions') ?></th>
</tr>
</thead>
<tbody>
<?php <?php
if (phpb_flash('message')): foreach ($pages as $page):
?> ?>
<div class="alert alert-<?= phpb_flash('message-type') ?> mb-6"> <tr>
<i class="text-xl ph-duotone ph-info"></i> <td>
<span><?= phpb_flash('message') ?></span> <?= phpb_e($page->getId()) ?>
</div> </td>
<td>
<?= phpb_e($page->getName()) ?>
</td>
<td>
<div class="hidden pl-4 pl-8"></div>
<div class="pl-<?= phpb_e((count(explode('/', $page->getRoute()))-2)*4) ?>">
<?= phpb_e($page->getRoute()) ?>
</div>
</td>
<td class="actions">
<a href="<?= phpb_e(phpb_full_url($page->getRoute())) ?>" title="<?= phpb_trans('website-manager.view') ?>" target="_blank" class="btn btn-light btn-outline btn-sm btn-circle">
<i class="text-xl ph-duotone ph-eye"></i>
</a>
<a href="<?= phpb_url('pagebuilder', ['page' => $page->getId()]) ?>" class="btn btn-primary btn-sm btn-circle" title="<?= phpb_trans('website-manager.edit') ?>">
<i class="text-xl ph-duotone ph-pencil-line"></i>
</a>
<a href="<?= phpb_url('website_manager', ['route' => 'page_settings', 'action' => 'edit', 'page' => $page->getId()]) ?>" title="<?= phpb_trans('website-manager.settings') ?>" class="btn btn-secondary btn-sm btn-circle">
<i class="text-xl ph-duotone ph-gear"></i>
</a>
<a href="<?= phpb_url('website_manager', ['route' => 'page_settings', 'action' => 'destroy', 'page' => $page->getId()]) ?>" title="<?= phpb_trans('website-manager.remove') ?>" class="btn btn-error btn-sm btn-circle">
<i class="text-xl ph-duotone ph-trash"></i>
</a>
</td>
</tr>
<?php <?php
endif; endforeach;
?> ?>
</tbody>
<table class="table table-zebra w-full"> </table>
<thead>
<tr>
<th class="w-5">ID</th>
<th><?= phpb_trans('website-manager.name') ?></th>
<th><?= phpb_trans('website-manager.route') ?></th>
<th class="w-44"><?= phpb_trans('website-manager.actions') ?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($pages as $page):
?>
<tr>
<td>
<?= phpb_e($page->getId()) ?>
</td>
<td>
<?= phpb_e($page->getName()) ?>
</td>
<td>
<div class="hidden pl-4 pl-8"></div>
<div class="pl-<?= phpb_e((count(explode('/', $page->getRoute()))-2)*4) ?>">
<?= phpb_e($page->getRoute()) ?>
</div>
</td>
<td class="actions">
<a href="<?= phpb_e(phpb_full_url($page->getRoute())) ?>" title="<?= phpb_trans('website-manager.view') ?>" target="_blank" class="btn btn-light btn-outline btn-sm btn-circle">
<i class="text-xl ph-duotone ph-eye"></i>
</a>
<a href="<?= phpb_url('pagebuilder', ['page' => $page->getId()]) ?>" class="btn btn-primary btn-sm btn-circle" title="<?= phpb_trans('website-manager.edit') ?>">
<i class="text-xl ph-duotone ph-pencil-line"></i>
</a>
<a href="<?= phpb_url('website_manager', ['route' => 'page_settings', 'action' => 'edit', 'page' => $page->getId()]) ?>" title="<?= phpb_trans('website-manager.settings') ?>" class="btn btn-secondary btn-sm btn-circle">
<i class="text-xl ph-duotone ph-gear"></i>
</a>
<a href="<?= phpb_url('website_manager', ['route' => 'page_settings', 'action' => 'destroy', 'page' => $page->getId()]) ?>" title="<?= phpb_trans('website-manager.remove') ?>" class="btn btn-error btn-sm btn-circle">
<i class="text-xl ph-duotone ph-trash"></i>
</a>
</td>
</tr>
<?php
endforeach;
?>
</tbody>
</table>
<div class="text-center mt-8"> <div class="text-center mt-8">
@@ -7,18 +7,6 @@ $settingIns = phpb_instance('setting');
<form method="post" action="<?= phpb_url('website_manager', ['route' => 'settings', 'action' => 'update', 'tab' => 'settings']) ?>"> <form method="post" action="<?= phpb_url('website_manager', ['route' => 'settings', 'action' => 'update', 'tab' => 'settings']) ?>">
<div class="max-w-lg mx-auto text-center">
<?php
if (phpb_flash('message')):
?>
<div class="alert alert-<?= phpb_flash('message-type') ?> mb-6">
<i class="text-xl ph-duotone ph-info"></i>
<span><?= phpb_flash('message') ?></span>
</div>
<?php
endif;
?>
<div class="w-full mb-6"> <div class="w-full mb-6">
<div class="label-text text-left"><?= phpb_trans('website-manager.website-languages') ?></div> <div class="label-text text-left"><?= phpb_trans('website-manager.website-languages') ?></div>
<?php <?php