Skip to content

Add Published documents screen#234

Merged
mcsf merged 2 commits into
mainfrom
add/privacy-page
May 22, 2026
Merged

Add Published documents screen#234
mcsf merged 2 commits into
mainfrom
add/privacy-page

Conversation

@mcsf

@mcsf mcsf commented May 21, 2026

Copy link
Copy Markdown
Member

Part of: #223

https://github.com/user-attachments/assets/8c7b757c-6c36-4434-a0d8-4d927a64d58b

cortext-published-documents-inline.mov

Summary

  • New full-canvas screen listing every page and collection currently published (status=publish), so users can see at a glance which documents are publicly accessible. Closes Better visibility / management of published documents #223.
  • Sidebar entry sits as a quick-action button immediately under Home, with a globe icon and pressed-state highlight when the route is active.
  • DataViews-based table with Title (links back to the document), Type, Modified, and Public link columns; sorts by Modified desc by default.

Implementation notes

  • New published kind in parseTarget / entityRouteReducer, mounted as a WorkspacePane from EntityRoute.
  • Pane uses __experimentalHeading, __experimentalText, __experimentalVStack from @wordpress/components for the header chrome — minimal bespoke CSS.
  • Queries added: PUBLISHED_PAGES_QUERY (page-queries.js) and PUBLISHED_COLLECTIONS_QUERY (collections.js). Inline collections are included since publishing them exposes their rows via REST.
  • Sidebar reuses cortext-sidebar__quick-action with a --published modifier; the existing hover/focus rule was generalised to target __quick-actions > .components-button so we don't duplicate per-modifier.

Test plan

  • Click "Published documents" in the sidebar — URL canonicalises to ?p=/published, pane renders pages + collections with status=publish.
  • Reload on ?p=/published — paints directly without bouncing through the home-redirect.
  • Publish a draft page → screen lists it. Unpublish → it disappears.
  • Click a page row → opens the Canvas editor; click a collection row → opens CollectionPane. Back returns to Published documents.
  • Trash a published page → it leaves the list; restore → it returns.
  • Visit ?p=/published/foo → falls through to document-not-found.
  • Empty case: no published documents → muted "No documents are currently public." text.
  • Sidebar entry shows is-pressed styling only while on the Published documents screen.
  • Collapsed sidebar: button shrinks to icon-only and remains tappable.

🤖 Generated with Claude Code

@mcsf mcsf requested a review from priethor May 21, 2026 16:27
if ( item.kind !== 'page' || ! item.link ) {
return (
<Text variant="muted">
{ __( 'Embedded in pages', 'cortext' ) }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice touch, although I found it confusing; this sounded like it was an embedded/inline collection, but in reality, it's cascade-published by the parent page containing the collection view block, but the collection doesn't live inside the page.

Another question is whether non-inline/full-page collections should have a public URL when they are cascade-published rather than manually published.

My gut says "no", because when we publish a page and collection view blocks, we should probably just publish the view, with its filters and columns locked, so we shouldn't just allow users to see the whole collection as a result of the page publishing.

@mcsf

mcsf commented May 22, 2026

Copy link
Copy Markdown
Member Author

Refined to distinguish full from inline collections:

  • Inline collections don't have a public URL but show as "Embedded in "
  • Non-inline don't have a public URL but show with an explanatory tooltip about the fact that their data is public
cortext-published-documents-inline.mov

This work could later tie with the concepts in #235 so that even full collections could list where they are embedded. In this case, we'd still want to keep the tooltip.

Alternatively, we could explore something a lot more sophisticated as you hint at in #234 (comment) to equip the CollectionRows controller to only disclose data (rows and columns) based on view settings defined for that collection's public pages.

mcsf and others added 2 commits May 22, 2026 12:42
Adds a sidebar entry and full-canvas screen that lists every page and
collection currently published, so users can see at a glance which
documents are publicly accessible. Closes #223.

The pane uses @wordpress/dataviews over a merged query of crtxt_page and
crtxt_collection records filtered by status=publish, with title (linking
back to the document), type, modified date, and public link columns.
Navigation goes through a new `published` kind in the route reducer; the
sidebar entry is a quick-action button next to Home.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Public link column was hardcoding every collection to "Embedded in
pages", regardless of workspace mode. Inline collections now render
"Embedded in <owner page title>" with the title acting as a navigation
link to the owner page; full-page collections (which have no canonical
URL but whose rows are still REST-queryable when published) render
"N/A" alongside an Infotip explaining the distinction.

Exposes _cortext_inline_owner_page read-only via REST so the pane can
resolve the owner page title client-side. Writes remain locked by the
existing auth_callback and CollectionsController::validate_pre_insert.

Adds a reusable Infotip component on top of @wordpress/components'
Popover, mirroring the Gutenberg design system's Infotip pattern
(Popover with openOnHover) since @wordpress/ui isn't a dependency
here. Preferred over Tooltip when the trigger's only purpose is to
reveal the popup, as tooltips are hidden from touch users and
announce as no-op buttons to assistive tech.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mcsf mcsf force-pushed the add/privacy-page branch from 4daf820 to b2a7f1b Compare May 22, 2026 11:51
@mcsf mcsf merged commit 781d046 into main May 22, 2026
10 checks passed
@mcsf mcsf deleted the add/privacy-page branch May 22, 2026 13:30
@priethor

Copy link
Copy Markdown
Collaborator

Nice!

@priethor priethor added this to the 0.1.0 milestone May 28, 2026
@priethor priethor added type: enhancement Improvement to existing behavior. area: publishing Public rendering through WordPress, templates, frontend block output, and theme-facing views. labels May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: publishing Public rendering through WordPress, templates, frontend block output, and theme-facing views. type: enhancement Improvement to existing behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better visibility / management of published documents

2 participants