refactor(user/system_msg): uoj_form_v2

This commit is contained in:
Baoshuo Ren 2023-01-16 07:51:30 +08:00
parent e218f58521
commit ffc71db799
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -13,8 +13,7 @@ if (!isSuperUser(Auth::user()) && Auth::id() != $user['username']) {
} }
function newDeleteSystemMsgForm($id) { function newDeleteSystemMsgForm($id) {
$form = new UOJBs4Form('remove_system_msg_' . $id); $form = new UOJForm('remove_system_msg_' . $id);
$form->addHidden("msg_id", $id, function ($msg_id) { $form->addHidden("msg_id", $id, function ($msg_id) {
global $user; global $user;
@ -33,10 +32,10 @@ function newDeleteSystemMsgForm($id) {
$msg_id = $_POST["msg_id"]; $msg_id = $_POST["msg_id"];
DB::delete("delete from user_system_msg where id = {$msg_id}"); DB::delete("delete from user_system_msg where id = {$msg_id}");
}; };
$form->submit_button_config['text'] = '删除'; $form->config['submit_button']['class'] = 'btn btn-link text-decoration-none text-danger p-0';
$form->submit_button_config['class_str'] = 'btn btn-link text-decoration-none text-danger p-0 mt-0'; $form->config['submit_button']['text'] = '删除';
$form->submit_button_config['align'] = 'inline'; $form->config['submit_container']['class'] = 'd-inline';
$form->submit_button_config['smart_confirm'] = ''; $form->config['confirm']['smart'] = true;
return $form; return $form;
} }
@ -98,7 +97,7 @@ foreach ($pag->get() as $idx => $msg) {
</li> </li>
<?php endforeach ?> <?php endforeach ?>
<?php if ($pag->isEmpty()) : ?> <?php if ($pag->isEmpty()) : ?>
<div class="text-center"> <div class="text-center my-4">
<?= UOJLocale::get('none') ?> <?= UOJLocale::get('none') ?>
</div> </div>
<?php endif ?> <?php endif ?>