MishkaCmsCoreWeb.Live.Admin.Dashboard.Runtime.Page.Index (Mishka CMS Core v0.0.1)

Copy Markdown View Source

The admin's page list, and the modal that makes a new one.

Two ways to create, both on the "+ Add" button

The button that opens the create modal carries a caret, and the caret holds the two ways of ending up in the visual editor with a new page:

  • Fill in the details, then open the editor — pressing it records the intent in open_builder? and opens the ordinary modal. The save that follows is the ordinary save; the guarded {:form_saved, :create, result} clause below turns it into a redirect. The question is asked where the reader is choosing how to make one, not at the bottom of a modal they have already committed to.
  • Create empty & open editor — a plain link to /admin/dashboard/runtime/builder/page. It LEAVES without opening the modal at all, so none of this form's validations fire on a form the reader has just said they do not want to fill in; the editor asks for the two or three things a record cannot exist without and makes it there.

One modal for everything

Creating, viewing and editing all happen in the inspector modal's Configuration tab (MishkaCmsCoreWeb.Live.Admin.Dashboard.Runtime.PreviewHelpers). There is no separate page-form-modal: two mounts of one form component on a page collide on their DOM id, and the form is what an author edits after reading the very tabs beside it.

Add translation

A row's "Add translation" asks two things — which of the site's languages, and at what path — and then creates the page through its own create action, as the reader: see MishkaCmsCore.Runtime.PageEditions.translate/4. The path follows the language until the reader types one of their own. The new edition opens on the inspector's Configuration tab, inactive.

Summary

Functions

Callback implementation for Phoenix.LiveView.render/1.

Functions

render(assigns)

Callback implementation for Phoenix.LiveView.render/1.