forked from laysense/laysense.cn
37 lines
2.4 KiB
PHP
37 lines
2.4 KiB
PHP
<?php
|
|
use App\Content\View;
|
|
|
|
$e = View::escape(...);
|
|
?>
|
|
<a class="back-link" href="/admin/catalog">返回目录管理</a>
|
|
<header class="admin-heading"><h1><?= $e($title) ?></h1></header>
|
|
<?= View::fragment('admin-feedback', compact('error', 'saved')) ?>
|
|
<form class="admin-form admin-panel" method="post" action="/admin/catalog/<?= $e($id ?? 'new') ?>">
|
|
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
|
<input type="hidden" name="version" value="<?= $e($product['version']) ?>">
|
|
<div class="form-grid">
|
|
<label>名称<input name="name" value="<?= $e($product['name']) ?>" required maxlength="100"></label>
|
|
<label>分类<input name="category" value="<?= $e($product['category']) ?>" required maxlength="70"></label>
|
|
</div>
|
|
<div class="form-grid">
|
|
<?= View::fragment('studio-asset-field', ['label' => '封面', 'name' => 'image', 'value' => $product['image']]) ?>
|
|
<label>封面替代文本<input name="alt" value="<?= $e($product['alt']) ?>" maxlength="200"></label>
|
|
</div>
|
|
<div class="form-grid">
|
|
<label>按钮文案<input name="label" value="<?= $e($product['label']) ?>" required maxlength="70"></label>
|
|
<label>按钮链接<input name="url" value="<?= $e($product['url']) ?>" required maxlength="1000"></label>
|
|
<label>次要链接文案<input name="extra_label" value="<?= $e($product['extra_label']) ?>" maxlength="70"></label>
|
|
<label>次要链接<input name="extra_url" value="<?= $e($product['extra_url']) ?>" maxlength="1000"></label>
|
|
</div>
|
|
<label>排序<input type="number" name="position" min="-999999" max="999999" value="<?= $e($product['position'] === '' ? 100 : $product['position']) ?>" required><small>数值越小越靠前。</small></label>
|
|
<?= View::fragment('admin-editor', ['format' => 'html', 'body' => $product['body']]) ?>
|
|
<div class="form-submit"><button class="button button-primary" type="submit">保存条目</button></div>
|
|
</form>
|
|
<?php if ($id !== null): ?>
|
|
<form class="admin-form" method="post" action="/admin/catalog/<?= $e($id) ?>">
|
|
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
|
<input type="hidden" name="version" value="<?= $e($product['version']) ?>">
|
|
<div class="form-submit"><button class="button button-outline" type="submit" name="operation" value="delete" data-confirm="从公开目录删除此条目?">删除条目</button></div>
|
|
</form>
|
|
<?php endif ?>
|