Add a real replacement Posts management page (v2.5.0)

Posts was previously just dark-themed skinning over the native
edit.php list table, unlike Comments/Plugins which are genuine
replacements. Built the same way: new PostsData.php REST controller
(list with status/search filters matching native tabs, trash, restore,
permanent delete) and a Vue page matching the Comments layout.

- SubApps.php registers it as aurora-admin-posts, parented under
  edit.php (same pattern as Plugins under plugins.php).
- redirect_native_pages() redirects direct edit.php visits (typed URL,
  not just the sidebar link) to the Aurora page — gated to the default
  post type only, so Pages and other custom post types are untouched.
- MenuSerializer rewrites the sidebar's Posts/All Posts links the same
  way Plugins/Comments already were.
- Gated by Settings > Posts' "Modern posts table" toggle, re-added now
  that it has a real implementation (it was removed a few commits ago
  for describing a feature that didn't exist).
- Fixed modern_plugins/modern_comments/modern_posts all defaulting to
  visually "on" in the Settings UI to match their actual PHP default.

Verified live: trash/restore/status filters/search all work correctly,
edit.php redirects to the Aurora page, edit.php?post_type=page (Pages)
correctly does not.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
nixpanel
2026-07-05 05:59:11 -05:00
co-authored by Claude Sonnet 5
parent d8bf1ae049
commit 56b6674527
12 changed files with 998 additions and 18 deletions
+49 -1
View File
@@ -1,6 +1,6 @@
# Aurora Admin v2 — Project Status
_Last updated: 2026-07-04 (latest session — remaining placeholder settings wired up, dashboard scrolling and admin notices fixed)_
_Last updated: 2026-07-05 (latest session — real Posts replacement page, first of the "skinned vs. replaced" pages to actually get replaced)_
## What this project is
@@ -147,6 +147,54 @@ get back up to speed instead of relying on prior chat history.
it keeps its own independent expand/collapse state
(`localStorage['aurora-nav-expanded']`) — not part of this accordion.
## Skinned vs. replaced native pages (important distinction, ask before assuming)
Not every native WP admin page gets the same treatment, and the user has
explicitly said they don't want the "skinned" approach used more broadly
without a real replacement behind it — check this list before describing
a page as "already handled":
- **Actually replaced** — the native page never renders; a real custom Vue
page (own REST controller, own list/detail UI) takes over entirely:
Comments, Installed Plugins, Menu Creator, Admin Notices, Role Editor,
Activity Log, Database Explorer, and now **Posts** (added this session
— see below).
- **Just skinned** — the real native WordPress page still renders; only
`admin/assets/native-dark.css` restyles it dark. Same underlying
markup, same native limitations, no new functionality: Pages, Media,
Users, and every other native screen not listed above.
**Posts** (`admin/src/Rest/PostsData.php` + `app/src/pages/posts/Posts.vue`,
entry `posts.js`) was the first of these converted from skinned to
replaced, built directly off the Comments pattern:
- REST: GET `/posts` (status/search/pagination, matching native filters:
all/publish/draft/pending/trash), POST `/posts/trash`, POST
`/posts/restore`, DELETE `/posts/{id}` (permanent). Capability checks
mirror native (`edit_posts` to list, `edit_post`/`delete_post` per-item).
- `SubApps.php`: registered as `aurora-admin-posts`, parented under
`edit.php` (same pattern as Plugins under `plugins.php`) so it shares
the native "Posts" top-level menu's `hook_suffix` slot.
- `SubApps::redirect_native_pages()`: visiting `edit.php` directly (typed
URL, bookmark — not just the sidebar link) redirects to the Aurora page,
gated on **only** the default post type (`post_type=post` or absent) —
`edit.php?post_type=page` (Pages) and any other custom post type's list
screen is explicitly left alone, since only Posts has a replacement.
- `MenuSerializer.php`: the sidebar's own "Posts"/"All Posts" links
(both share the literal `edit.php` slug) get rewritten the same way
Plugins'/Comments' links already were.
- Gated by Settings > Posts' "Modern posts table" toggle — this is the
same toggle that got **removed** two commits ago for describing a
feature that didn't exist; it's back now that it does, defaulting to
on. `modern_plugins`/`modern_comments` also got a `default: true` UI
fix at the same time (they already defaulted true server-side, but the
Settings UI toggle showed off until explicitly saved — cosmetic
mismatch, now consistent).
- **Not done**: Pages, Media, Users remain skinned-only. Each would be a
comparable-sized build to Posts/Comments (own REST controller, own
list/detail UI) — ask the user before starting one, per the pattern
established this session (they picked "Posts first, then expand" over
doing all four at once).
## Theme system (rewrite — supersedes the old dark_mode 3-state model)
Went through several rounds of user-directed rework this session, landing on: