Files
FamilyBook/templates/days/_settings_menu.php
T
laoyang 9a66068c33 v62:纪念日列表修正 / 分类图标与设置菜单 / 首页卡片体系
- 纪念日列表:display:flex 从 td 移到内层 div(写在 td 上会破坏表格列算法,
  表现为关联人列与其它列高度不一致);行内列序按表头对齐;
  改完再点「新建」不再带出上次修改的数据;文案改为「与我相关」「来自名册」;
  别人记的、把我挂成关联人的条目一并显示(split() 返回 hiddenIds,
  路由层据此过滤「接下来的日子」,与两张表同一套可见性)
- 分类图标:新增 app/AnnivIcon.php(17 个行内 SVG 图标 + 同 key 的 emoji
  供日历纯文本处使用,内网无 CDN 不用 FontAwesome);去掉「看日历」按钮;
  设置按钮改为菜单,第一项进 days/settings 独立页;分类可自选图标,
  列表徽标与日历条目都按分类显示
- 首页卡片:新增 app/HomeCards.php 与 templates/home_cards.php;
  8 格宽 × 高 2/4/6/8;首页拆成 templates/home/_card_*.php 共 8 个片段;
  home/cards 可改尺寸、调顺序、开关
2026-10-19 12:51:17 +08:00

52 lines
2.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* 纪念日模块的「设置」下拉(v24 用户 2026-10-03 第 9 条;🔴 v62 改成菜单)。
*
* v24 原话:「在新建纪念日和右侧,也增加设置按钮,可以设置纪念日的分类。」
* —— 当时做成了"下拉里直接铺一张分类增删表单"。
*
* 🔴 v62(用户 2026-10-18 第 2 条):「设置按钮,点击后弹菜单,**第一个菜单是分类设置**,
* 进去之后可以设置分类,每一类纪念日都有不同的图标……」
* ⇒ 与日程/观影/任务三个模块**统一手感**(☰ → 一串列表 → 点进独立页):
* 下拉里**不放表单**,只放一条条目的链接;分类的增删改与图标选择都在
* `days/settings` 那一页上(见 templates/days/settings.php)。
*
* 为什么必须这么改(与日程那条同一个理由,别丢):分类是**家庭级**的,
* 一个家能有十几二十个分类,每个分类还要选图标 —— 全铺在下拉里,
* 下拉会被撑到屏幕外,而"设置"按钮点开本来就该是"一个目录"。
*
* 用法(require 前 set 好):
* $setCurrent 当前页 key('kinds')用来高亮;'' 也行(从别处挂过来时没有当前项)
*/
$setCurrent = (string)($setCurrent ?? '');
$setOn = static function (string $key) use ($setCurrent): string {
return $setCurrent === $key ? ' class="on"' : '';
};
$setIcon = static function (string $name): string {
$paths = [
// 分类:三个小方块("一格一类")
'kinds' => '<rect x="2" y="2.2" width="5" height="5" rx="1.2"/>'
. '<rect x="9" y="2.2" width="5" height="5" rx="1.2"/>'
. '<rect x="2" y="9" width="5" height="5" rx="1.2"/>'
. '<rect x="9" y="9" width="5" height="5" rx="1.2"/>',
];
$d = $paths[$name] ?? '';
if ($d === '') {
return '';
}
return '<svg class="mi" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"'
. ' fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"'
. ' stroke-linejoin="round">' . $d . '</svg>';
};
?>
<details class="movie-set menu ann-set">
<summary class="btn btn-icon" title="纪念日设置" aria-label="纪念日设置"><svg viewBox="0 0 16 16" width="18" height="18" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"><path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/></svg></summary>
<div class="menu-list ann-set-list">
<?php /* 第一项(也是目前唯一一项):分类设置 —— 名称 + 图标 + 删除 + 排序 */ ?>
<a href="<?= e(url('days/settings')) ?>"<?= $setOn('kinds') ?>><?= $setIcon('kinds') ?><span>分类设置</span></a>
</div>
</details>
<?php
// ⚠️ 只 unset **本片段自己定义**的变量,绝不碰宿主的 $setCurrent / $kinds / $canWrite。
unset($setCurrent, $setOn, $setIcon);