Skip to content

feat: add pages written in Desk (Compendium Page) - #28

Merged
barredterra merged 7 commits into
alyf-de:version-15-hotfixfrom
HenningWendtland:add-user-docs
Sep 29, 2026
Merged

barredterra merged 7 commits into
alyf-de:version-15-hotfixfrom
HenningWendtland:add-user-docs

Conversation

@HenningWendtland

@HenningWendtland HenningWendtland commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Lets users write documentation pages in Desk, stored in the site's database, on top of the docs that apps ship — e.g. a site wiki, or a correction of an app page that doesn't fit the site.

What changes

  • New DocType Compendium Page: title, language, path, sort order, roles, published flag, Markdown content. The path is filled from the title when empty (Getting Started → getting-started), is validated like file paths, and must be unique per language.
  • Composition (docs.py): published pages join discovery as the last layer, after all installed apps. A page at an app page's path replaces it; translations follow the existing canonical-language rules, so a translated page takes sort order and roles from the canonical page. Unpublished pages don't exist for readers and don't hide app pages.
  • Attachments: /private/files/… URLs in images and links are served through get_asset, only if the file is attached to that page and the reader may read it. Any other private file is refused, so authors can't expose files from elsewhere. Public /files/… URLs are left as they are.
  • Docs browser:
    • + Add new Page (users who may create a Compendium Page) at the bottom of the sidebar, and a + on each sidebar row (shown on hover) to add a page below it. The new form presets the current locale and the parent path (guides/ → guides/<slug> from the title).
    • Edit button in the page footer, next to "Copy as Markdown". For a page written in Desk it opens the form. For an app page it opens a dialog: Override with Compendium Page (create permission) or Edit on GitHub (Compendium Contributor role, and only when the app declares a repository and docs_branch). Without create permission, Edit goes straight to GitHub. The button only shows when one of these actions is available. The old footer text links are gone.
    • Override works like get_mapped_doc: make_override returns an unsaved Compendium Page with the app page's title, path, language, sort order, content and roles; the client syncs it and opens the form. Nothing is stored until the user saves.
  • Groups without an index page: clicking such a group now opens a generated overview that lists its child pages (only those the reader may see). Edit on the overview starts the group's index page (path and title preset). Breadcrumbs for these groups are now links.
  • Form: View button; a path ending in / (preset by the sidebar) gets the slug appended when the title is typed.
  • Search: the index fingerprint includes the pages' count and latest modified, so saves and deletes show up without a restart.
  • Permissions: System Manager and Compendium Contributor can create and edit pages. The browser checks DocType permissions (frappe.model.can_create, server-side has_permission for the edit route), so custom permissions carry over. Edit on GitHub stays tied to the Compendium Contributor role.

Notes

  • content has ignore_xss_filter: Frappe's save-time sanitizing escaped Markdown's > and broke blockquotes and alerts. Rendering still runs sanitize_html, so readers only ever get sanitized HTML (covered by a test).
  • The field is labelled Sort Order because Frappe translates "Order" into German as "Auftrag".
  • Images with relative paths in an app page don't carry over to an override; the docs tell authors to attach them.

Docs & tests

  • New user page "Writing Pages in Desk" (en + de), covering adding pages, groups and index pages, and overriding app pages; authoring guide, index and search pages updated; German translations for the new UI strings.
  • Tests for composition and override, make_override, the group overview (incl. hidden groups), the translation roles rule, path handling, attachment serving, the edit route and search freshness. Existing file-based tests no longer depend on pages stored on the site.
  • Cypress: Edit dialog with Edit on GitHub, + Add new Page and the group +.

Tested

  • A Compendium Page renders in Compendium, including all supported .md features
  • A Compendium Page can overwrite an App-generated Page.
  • Attachments work as described
  • Sidebar + Add new Page and + open a prefilled form
  • Edit → Override with Compendium Page opens a prefilled, unsaved form
  • A group without an index page shows the overview, and Edit starts its index page

@greptile-apps

greptile-apps Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Adds a new document type for pages stored in the database.

The PR appears safe to merge; the previous findings are resolved and the latest permission change restores authoring controls according to actual DocType permissions.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[App Markdown pages] --> C[Page discovery and composition]
    B[Published Compendium Pages] --> C
    C --> D{Same language and path?}
    D -->|Yes| E[Compendium Page overrides app page]
    D -->|No| F[Keep both pages]
    E --> G[Role and locale filtering]
    F --> G
    G --> H[Documentation tree and page view]
    H --> I[Sanitized Markdown rendering]
    I --> J{Database page private asset?}
    J -->|Yes| K[Verify page access and file attachment]
    J -->|No| L[Serve app or public asset normally]
Loading

Reviews (6) · Last reviewed commit: "fix: update permissions for creating and..."

Comment thread compendium/compendium/page/docs/docs.js Outdated
Comment thread compendium/compendium/doctype/compendium_page/compendium_page.py
@barredterra

Copy link
Copy Markdown
Member

@Mergifyio backport version-16-hotfix

@mergify

mergify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

backport version-16-hotfix

✅ Backports have been created

Details

Cherry-pick of 128eae6 has failed:

On branch mergify/bp/version-16-hotfix/pr-28
Your branch is up to date with 'origin/version-16-hotfix'.

You are currently cherry-picking commit 128eae6.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   README.md
	new file:   compendium/compendium/doctype/__init__.py
	new file:   compendium/compendium/doctype/compendium_page/__init__.py
	new file:   compendium/compendium/doctype/compendium_page/compendium_page.js
	new file:   compendium/compendium/doctype/compendium_page/compendium_page.json
	new file:   compendium/compendium/doctype/compendium_page/compendium_page.py
	new file:   compendium/compendium/doctype/compendium_page/test_compendium_page.py
	new file:   compendium/compendium/doctype/compendium_page_role/__init__.py
	new file:   compendium/compendium/doctype/compendium_page_role/compendium_page_role.json
	new file:   compendium/compendium/doctype/compendium_page_role/compendium_page_role.py
	modified:   compendium/docs.py
	modified:   compendium/docs/de/compendium/docs/authoring.md
	new file:   compendium/docs/de/compendium/docs/desk-pages.md
	modified:   compendium/docs/de/compendium/docs/index.md
	modified:   compendium/docs/de/compendium/docs/search.md
	modified:   compendium/docs/de/compendium/index.md
	modified:   compendium/docs/en/compendium/docs/authoring.md
	new file:   compendium/docs/en/compendium/docs/desk-pages.md
	modified:   compendium/docs/en/compendium/docs/index.md
	modified:   compendium/docs/en/compendium/docs/search.md
	modified:   compendium/docs/en/compendium/index.md
	modified:   compendium/search.py
	modified:   compendium/tests/test_docs.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   compendium/compendium/page/docs/docs.css
	both modified:   compendium/compendium/page/docs/docs.js
	both modified:   compendium/locale/de.po
	both modified:   compendium/locale/main.pot
	both modified:   cypress/integration/docs.js

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

A group without an index page now opens a generated list of its pages.
For contributors, Edit on the overview starts the group's index page.
The add button shows on every page, so a page can become a group.
Comment thread compendium/compendium/page/docs/docs.js Outdated
Replaced the role-based checks for contributors with a permission-based approach for creating Compendium Pages. Updated documentation to reflect the new permission requirements for users to see relevant buttons and functionalities.
@barredterra
barredterra merged commit 128eae6 into alyf-de:version-15-hotfix Sep 29, 2026
5 checks passed
barredterra added a commit that referenced this pull request Sep 29, 2026
Co-authored-by: barredterra <14891507+barredterra@users.noreply.github.com>
barredterra added a commit that referenced this pull request Sep 29, 2026
Co-authored-by: barredterra <14891507+barredterra@users.noreply.github.com>
Co-authored-by: Henning Wendtland <156231187+HenningWendtland@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants