feat(nav): finish remaining parity gaps (image_select, AJAX search, senior UI)
- Layout image_select previews (zibll PNGs under assets/images/header-layout) - Localize aksrtAdminData.themeUri for admin SPA asset URLs - Layout-2 inline search AJAX suggestions via aksrt_search_suggestions - Appearance→Menus visual senior submenu editor (cards/columns) - Acceptance checklist + automated source contract report
This commit is contained in:
@@ -132,6 +132,7 @@ class Admin {
|
||||
'siteUrl' => home_url('/'),
|
||||
'adminUrl' => admin_url('/'),
|
||||
'themeVersion' => wp_get_theme()->get('Version') ?: '3.4.0-dev',
|
||||
'themeUri' => defined('AKSRT_URI') ? AKSRT_URI : get_template_directory_uri(),
|
||||
'buildOk' => $missing_chunks === [],
|
||||
]);
|
||||
|
||||
|
||||
@@ -14,6 +14,24 @@ class NavMenuOptions {
|
||||
public static function init(): void {
|
||||
add_action('wp_nav_menu_item_custom_fields', [self::class, 'render_fields'], 10, 2);
|
||||
add_action('wp_update_nav_menu_item', [self::class, 'save'], 10, 2);
|
||||
add_action('admin_enqueue_scripts', [self::class, 'enqueue_admin']);
|
||||
}
|
||||
|
||||
public static function enqueue_admin(string $hook): void {
|
||||
if ($hook !== 'nav-menus.php') {
|
||||
return;
|
||||
}
|
||||
$path = get_template_directory() . '/assets/js/admin-nav-menu-senior.js';
|
||||
if (!file_exists($path)) {
|
||||
return;
|
||||
}
|
||||
wp_enqueue_script(
|
||||
'aksrt-admin-nav-menu-senior',
|
||||
get_template_directory_uri() . '/assets/js/admin-nav-menu-senior.js',
|
||||
['jquery'],
|
||||
(string) filemtime($path),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,15 +31,8 @@ class SchemaPageDisplay {
|
||||
['key' => 'header_scroll_down_hide', 'label' => '下滑隐藏导航栏', 'type' => 'switch', 'default' => true],
|
||||
]],
|
||||
['key' => 'layout-type', 'title' => '布局类型', 'fields' => [
|
||||
['key' => 'header_layout', 'label' => '桌面端布局', 'type' => 'radio', 'default' => '1', 'options' => [
|
||||
['label' => '布局 1(经典)', 'value' => '1'],
|
||||
['label' => '布局 2(内联搜索)', 'value' => '2'],
|
||||
['label' => '布局 3(紧凑)', 'value' => '3'],
|
||||
]],
|
||||
['key' => 'mobile_header_layout', 'label' => '移动端布局', 'type' => 'radio', 'default' => 'center', 'options' => [
|
||||
['label' => '居中(含搜索按钮)', 'value' => 'center'],
|
||||
['label' => '靠左', 'value' => 'left'],
|
||||
]],
|
||||
['key' => 'header_layout', 'label' => '桌面端布局', 'type' => 'image_select', 'default' => '1', 'options' => self::header_layout_options()],
|
||||
['key' => 'mobile_header_layout', 'label' => '移动端布局', 'type' => 'image_select', 'default' => 'center', 'options' => self::mobile_header_layout_options()],
|
||||
['key' => 'mobile_navbar_align', 'label' => '移动端菜单方向', 'type' => 'radio', 'default' => 'left', 'options' => [
|
||||
['label' => '顶部(关闭手势)', 'value' => 'top'],
|
||||
['label' => '左侧滑出', 'value' => 'left'],
|
||||
@@ -532,4 +525,24 @@ class SchemaPageDisplay {
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/** @return list<array{label:string,value:string,image:string}> */
|
||||
private static function header_layout_options(): array {
|
||||
$base = defined('AKSRT_URI') ? trailingslashit(AKSRT_URI) . 'assets/images/header-layout/' : '';
|
||||
return [
|
||||
['label' => '布局 1(经典)', 'value' => '1', 'image' => $base . 'header_layout_1.png'],
|
||||
['label' => '布局 2(内联搜索)', 'value' => '2', 'image' => $base . 'header_layout_2.png'],
|
||||
['label' => '布局 3(紧凑)', 'value' => '3', 'image' => $base . 'header_layout_3.png'],
|
||||
];
|
||||
}
|
||||
|
||||
/** @return list<array{label:string,value:string,image:string}> */
|
||||
private static function mobile_header_layout_options(): array {
|
||||
$base = defined('AKSRT_URI') ? trailingslashit(AKSRT_URI) . 'assets/images/header-layout/' : '';
|
||||
return [
|
||||
['label' => '居中(含搜索按钮)', 'value' => 'center', 'image' => $base . 'mobile_header_layout_center.png'],
|
||||
['label' => '靠左', 'value' => 'left', 'image' => $base . 'mobile_header_layout_left.png'],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user