Build a full-width CMS canvas and restore featured home products

This commit is contained in:
2026-11-21 21:33:15 +09:00
parent 00d7d6f9ad
commit e7c7a8928e
16 changed files with 590 additions and 122 deletions
+9 -3
View File
@@ -16,9 +16,14 @@ use Webman\Http\UploadFile;
final class StudioController extends AdminController
{
private const BLOCKS = [
public const BLOCKS = [
'text' => ['正文', '<p>在这里输入区块内容。</p>'],
'image' => ['图文', '<p>介绍图片内容,然后从媒体库插入图片。</p>'],
'image' => ['图文', '<div class="studio-split"><img src="/assets/original/home-hero.webp" alt="" loading="lazy"><div><h3>介绍主题</h3><p>在这里说明图片或产品。</p></div></div>'],
'banner' => ['横幅', '<div class="studio-banner"><h3>用一句话介绍你的项目</h3><p>简要说明项目能为访客做什么。</p><a class="button button-primary" href="/services">了解更多</a></div>'],
'features' => ['特性卡片', '<div class="card-grid feature-grid"><article class="content-card feature-card"><h3>特点一</h3><p>介绍这个特点。</p></article><article class="content-card feature-card"><h3>特点二</h3><p>介绍这个特点。</p></article><article class="content-card feature-card"><h3>特点三</h3><p>介绍这个特点。</p></article></div>'],
'quote' => ['引文', '<blockquote><p>在这里填写引用或用户反馈。</p></blockquote>'],
'table' => ['对比表格', '<table><thead><tr><th scope="col">项目</th><th scope="col">说明</th></tr></thead><tbody><tr><td>项目一</td><td>填写说明</td></tr><tr><td>项目二</td><td>填写说明</td></tr></tbody></table>'],
'list' => ['步骤列表', '<ol><li>填写第一步</li><li>填写第二步</li><li>填写第三步</li></ol>'],
'cta' => ['行动按钮', '<p>说明下一步。</p><p><a class="button button-primary" href="#contact">联系来笙</a></p>'],
'faq' => ['常见问题', '<div class="faq"><details><summary>请输入问题</summary><div><p>请输入答案。</p></div></details></div>'],
];
@@ -86,7 +91,8 @@ final class StudioController extends AdminController
if (!in_array($action, ['up', 'down', 'delete'], true)) {
throw new RuntimeException('操作不可用。');
}
$repo->arrangeSection($slug, $key, $action, $this->version($request));
$pageVersion = $this->input($request, 'page_version');
$repo->arrangeSection($slug, $key, $action, $this->version($request), ctype_digit($pageVersion) ? (int) $pageVersion : -1);
return $this->success($request, "/admin/pages/$slug#blocks");
} catch (RuntimeException $error) {