fix(kin,movies): 家谱连线重构为单一网格 + 观影设置统一页头
需求三点: 1. 观影模块「⚙ 设置」与「记一场电影」按钮高度不一致 → 统一页头动作区 四个选择器的 padding/font-size(.btn 与 .btn-sm 混用是根因);并把设置 下拉推广到观影全部页面(详情/影院/搜索/统计/报告/表单),落在返回按钮旁。 2. 家谱连线「线乱」→ 根因三条:每代各建一个网格(列宽最小值由内容决定, 各代不一致,窄屏实测 93.5px vs 164/78/78/78px);落点用百分比算而 grid 间距不参与百分比;连线行与卡片行不是同一套列。 改法:整棵树只留一个网格,辈分行/卡片行/连线行全是它的行,连线元素本身 也是网格项(靠 justify-self 落位);列宽固定为一卡之宽(不用 minmax/1fr, 否则宽屏卡片中心 ≠ 列中心)。 3. 亲属关系接口改白名单(parent/child/spouse)——原先未知 kind 被静默记成 配偶,夹具传 kind=sibling 让家谱断言长期拿错数据自证。 设置下拉抽成可复用片段 _settings_menu.php($setCurrent 高亮当前页、 $setCanWrite 控「影院管理」显隐),六七个页头不再各抄一份。 验证:e2e 456/0、桌面几何 268/0、移动端几何 504/0、交互 97/0、 家谱连线诊断 0 失败、静态空跑 exit=0、静态断言证伪 13/13、 反向验证 68/68 全抓住。
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* 观影模块的「⚙ 设置」下拉 —— 影院管理 / 高级搜索 / 统计 / 年度报告。
|
||||
*
|
||||
* 为什么抽成片段:v11 这个下拉只长在观影列表页一个地方;用户随后要求
|
||||
* 「设置这个按钮,在观影详情等页面也都要出现,就出现在返回等按钮的旁边」。
|
||||
* 与其把同一段 <details> 复制到六七个页头(改一处就得改六处、迟早漏),
|
||||
* 不如让所有观影页 require 同一个片段。
|
||||
*
|
||||
* 用法(include 前 set 好):
|
||||
* $setCurrent 当前页的 key('list' | 'cinemas' | 'search' | 'stats' | 'report' | 'show' | 'form')
|
||||
* —— 用来高亮菜单里对应的那一项。空串表示都不高亮。
|
||||
* $setCanWrite 是否显示「影院管理」(只有能写的人才有管理入口)
|
||||
*
|
||||
* ⚠️ 高亮用 `a.on`(.movie-set .menu-list a.on 已有样式)。**不做「隐藏当前页那一项」**:
|
||||
* 隐藏会让菜单在不同页面长短不一,用户更难认出「这是同一套入口」。
|
||||
*/
|
||||
$setCurrent = (string)($setCurrent ?? '');
|
||||
$setCanWrite = (bool)($setCanWrite ?? false);
|
||||
$setOn = static function (string $key) use ($setCurrent): string {
|
||||
return $setCurrent === $key ? ' class="on"' : '';
|
||||
};
|
||||
?>
|
||||
<details class="movie-set menu">
|
||||
<summary class="btn btn-ghost" title="观影设置">⚙ 设置</summary>
|
||||
<div class="menu-list">
|
||||
<?php if ($setCanWrite): ?>
|
||||
<a href="<?= e(url('movies/cinemas')) ?>"<?= $setOn('cinemas') ?>>影院管理</a>
|
||||
<?php endif; ?>
|
||||
<a href="<?= e(url('movies/search')) ?>"<?= $setOn('search') ?>>高级搜索</a>
|
||||
<a href="<?= e(url('movies/stats')) ?>"<?= $setOn('stats') ?>>统计</a>
|
||||
<a href="<?= e(url('movies/report')) ?>"<?= $setOn('report') ?>>年度报告</a>
|
||||
</div>
|
||||
</details>
|
||||
<?php
|
||||
// 用完即清,避免残留在后续 include 里(与 _datetime.php 同一纪律)
|
||||
unset($setCurrent, $setCanWrite, $setOn);
|
||||
?>
|
||||
@@ -18,7 +18,8 @@ $canWrite = \App\Auth::canWrite();
|
||||
<h1>影院管理</h1>
|
||||
<span class="sub">共 <?= count($cinemas) ?> 家影院</span>
|
||||
<div class="actions">
|
||||
<a class="btn btn-ghost btn-sm" href="<?= e(url('movies')) ?>">返回观影记录</a>
|
||||
<?php $setCurrent = 'cinemas'; $setCanWrite = $canWrite; require __DIR__ . '/_settings_menu.php'; ?>
|
||||
<a class="btn btn-ghost" href="<?= e(url('movies')) ?>">返回观影记录</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -31,6 +31,15 @@ $selAttendees = array_map('intval', (array)old('attendees', $curAttendees));
|
||||
<div class="page-head">
|
||||
<h1><?= $isEdit ? '编辑观影记录' : '记一场电影' ?></h1>
|
||||
<span class="sub"><?= $isEdit ? e($m['title']) : '片名必填,其他都可以以后再补' ?></span>
|
||||
<div class="actions">
|
||||
<?php /* 用户要求「设置这个按钮,在观影详情等页面也都要出现,就出现在返回等按钮的旁边」。
|
||||
表单页没有返回按钮(提交/取消在表单底部),设置就放在页头动作区。 */ ?>
|
||||
<?php $setCurrent = 'form'; $setCanWrite = \App\Auth::canWrite(); require __DIR__ . '/_settings_menu.php'; ?>
|
||||
<a class="btn btn-ghost"
|
||||
href="<?= e($isEdit ? url('movies/show', ['id' => (int)$m['id']]) : url('movies')) ?>">
|
||||
<?= $isEdit ? '返回详情' : '返回观影' ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form method="post" enctype="multipart/form-data"
|
||||
|
||||
@@ -26,19 +26,11 @@ $fmtNum = static function ($v): string {
|
||||
<?php if ($canWrite): ?>
|
||||
<a class="btn" href="<?= e(url('movies/new')) ?>">记一场电影</a>
|
||||
<?php endif; ?>
|
||||
<?php /* v11:右侧的「设置」按钮 —— 影院管理与从 MovieLog 迁来的
|
||||
高级搜索 / 统计 / 年度报告都收在这里(顶栏不再单放「影院」)。 */ ?>
|
||||
<details class="movie-set menu">
|
||||
<summary class="btn btn-ghost btn-sm" title="观影设置">⚙ 设置</summary>
|
||||
<div class="menu-list">
|
||||
<?php if ($canWrite): ?>
|
||||
<a href="<?= e(url('movies/cinemas')) ?>">影院管理</a>
|
||||
<?php endif; ?>
|
||||
<a href="<?= e(url('movies/search')) ?>">高级搜索</a>
|
||||
<a href="<?= e(url('movies/stats')) ?>">统计</a>
|
||||
<a href="<?= e(url('movies/report')) ?>">年度报告</a>
|
||||
</div>
|
||||
</details>
|
||||
<?php /* 右侧的「⚙ 设置」—— 影院管理与从 MovieLog 迁来的
|
||||
高级搜索 / 统计 / 年度报告都收在这里(顶栏不再单放「影院」)。
|
||||
⚠️ 片段里的按钮**不带 btn-sm**:页头动作区必须同高,见 app.css 的
|
||||
「页头动作统一尺寸」一节(用户明确要求这两个按钮高度一致)。 */ ?>
|
||||
<?php $setCurrent = 'list'; $setCanWrite = $canWrite; require __DIR__ . '/_settings_menu.php'; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@ $fmtDate = static function (?string $d): string {
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</form>
|
||||
<a class="btn btn-ghost btn-sm" href="<?= e(url('movies')) ?>">返回观影</a>
|
||||
<?php $setCurrent = 'report'; $setCanWrite = \App\Auth::canWrite(); require __DIR__ . '/_settings_menu.php'; ?>
|
||||
<a class="btn btn-ghost" href="<?= e(url('movies')) ?>">返回观影</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
<h1>高级搜索</h1>
|
||||
<span class="sub">组合多个条件精确查找</span>
|
||||
<div class="actions">
|
||||
<a class="btn btn-ghost btn-sm" href="<?= e(url('movies')) ?>">返回观影</a>
|
||||
<?php $setCurrent = 'search'; $setCanWrite = \App\Auth::canWrite(); require __DIR__ . '/_settings_menu.php'; ?>
|
||||
<a class="btn btn-ghost" href="<?= e(url('movies')) ?>">返回观影</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -143,15 +143,17 @@ $commentBox = static function (int $reviewId, int $parentId, string $summary) us
|
||||
<span class="sub">观影记录</span>
|
||||
<div class="actions">
|
||||
<?php if ($canWrite): ?>
|
||||
<a class="btn btn-ghost btn-sm" href="<?= e(url('movies/edit', ['id' => (int)$m['id']])) ?>">编辑</a>
|
||||
<a class="btn btn-ghost" href="<?= e(url('movies/edit', ['id' => (int)$m['id']])) ?>">编辑</a>
|
||||
<form method="post" action="<?= e(url('movies/destroy')) ?>"
|
||||
onsubmit="return confirm('删除这条观影记录?海报、票根、照片也会一并删除,不可恢复。')">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="id" value="<?= (int)$m['id'] ?>">
|
||||
<button type="submit" class="btn btn-danger btn-sm">删除</button>
|
||||
<button type="submit" class="btn btn-danger">删除</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<a class="btn btn-ghost btn-sm" href="<?= e(url('movies')) ?>">返回列表</a>
|
||||
<?php /* 设置入口要出现在「返回等按钮的旁边」(用户原话) */ ?>
|
||||
<?php $setCurrent = 'show'; $setCanWrite = $canWrite; require __DIR__ . '/_settings_menu.php'; ?>
|
||||
<a class="btn btn-ghost" href="<?= e(url('movies')) ?>">返回列表</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ $wd = static function (?string $d): string {
|
||||
<h1>观影统计</h1>
|
||||
<span class="sub">一家人的观影概览</span>
|
||||
<div class="actions">
|
||||
<a class="btn btn-ghost btn-sm" href="<?= e(url('movies')) ?>">返回观影</a>
|
||||
<?php $setCurrent = 'stats'; $setCanWrite = \App\Auth::canWrite(); require __DIR__ . '/_settings_menu.php'; ?>
|
||||
<a class="btn btn-ghost" href="<?= e(url('movies')) ?>">返回观影</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user