Editing in the dash

The dash: where editors work, what each tab of the edit panel does, and how templates connect the preview to its fields.

Updated
On this page

Signing in

The editing interface is the built-in phlat/dash addon, mounted by the page at /admin. Anyone whose role has the admin.access permission can open it. Sign in at /@users/login, and create the first account from the terminal:

phlat user:create alex --role=admin

What editors see

A rail down the left side leads to the page editor, collections, pinned pages, search (Ctrl K) and, at the bottom, the editor's profile, users and system. Opening a page shows the real site in a preview beside the edit panel, so what an editor sees is what visitors will get. Browsing inside the preview moves the edit panel to the page being shown, unless the panel is on a pinned page, which it stays on. The toolbar above the panel holds that page's actions: settings, rename or move, delete, pin and new child page. The site pins pages for everyone in a field on the dash page, and each editor pins their own from that menu; theirs sit below a divider in the rail.

The edit panel has four tabs:

Tab Holds
Data The fields the page's view lists, as form inputs
Files The page's files: upload, alt text, make private, delete
History Every saved revision of the page, with restore
Settings Published, access, hidden and locked. Needs the pages.publish permission

A view can limit the tabs its pages show with a tabs key in its index.json:

// site/views/settings/index.json
{
    "tabs": ["data", "files"]
}

The dash also has pages for users, collections, search and the system: installed addons, History sync and the registry.

Three overviews are for editors and need admin.access: /assets lists the site's files, /favicon checks the favicon set against what browsers and home screens ask for, and /fonts shows each font as a specimen. The pages stay public so their files keep serving.

With debug on, the Clockwork page lists the recorded requests, newest first. Filter them by URL, method and status class, and open one for its timeline, database queries, log, request, session, data and views. It needs admin.access, and without debug it is a 404.

Drafts and saving

Edits are autosaved as a draft, _draft.json in the page folder. Only editors see a draft, in the preview. Save writes the draft to the page and records it in History. A new page starts unpublished; publish it on the Settings tab. See Publishing and access.

Connecting templates to fields

Mark the element that shows a field with n:edit. In the preview, editors can then click it to jump to that field in the edit panel:

<h1 n:edit="$page->title">{$page->title}</h1>

<div n:edit="$page->body" class="prose">{$page->body|render}</div>

n:edit adds a data-edit-field attribute to the element and no wrapper. {edit $page->field}...{/edit} wraps its content in a <div> instead, for content with no single element of its own. Both mark only the preview, not the public page.

isPreview() is true when the page is rendering inside the dash's preview for a signed-in editor, for markup only editors should see.

Customising

The dash is an addon like any other, so its templates can be overridden under site/views/@dash/. See Overrides. Field editors come from each field type's edit.latte. See Custom fields.