refactor(blog/delete): uoj_form_v2

This commit is contained in:
Baoshuo Ren 2023-01-16 07:52:38 +08:00
parent ffc71db799
commit 77f22ce40c
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -8,20 +8,19 @@ UOJBlog::init(UOJRequest::get('id')) || UOJResponse::page404();
UOJBlog::cur()->belongsToUserBlog() || UOJResponse::page404();
UOJBlog::cur()->userCanManage(Auth::user()) || UOJResponse::page403();
$delete_form = new UOJBs4Form('delete');
$delete_form = new UOJForm('delete');
$delete_form->handle = function () {
UOJBlog::cur()->delete();
};
$delete_form->submit_button_config['class_str'] = 'btn btn-danger';
$delete_form->submit_button_config['text'] = '是的,我确定要删除';
$delete_form->config['submit_button']['class'] = 'btn btn-danger';
$delete_form->config['submit_button']['text'] = '是的,我确定要删除';
$delete_form->succ_href = HTML::blog_url(UOJBlog::info('poster'), '/archive');
$delete_form->runAtServer();
?>
<?php echoUOJPageHeader('删除博客 - ' . HTML::stripTags(UOJBlog::info('title'))) ?>
<h1 class="h2 text-center">
您真的要删除博客 <?= UOJBlog::info('title') ?>” <span class="fs-5">(博客 ID<?= UOJBlog::info('id') ?></span>吗?该操作不可逆!
您真的要删除博客 <?= UOJBlog::info('title') ?>” <span class="fs-5">(博客 ID: <?= UOJBlog::info('id') ?></span>吗?该操作不可逆!
</h1>
<?php $delete_form->printHTML(); ?>