MishkaCmsCoreWeb.Templates.DraftList (Mishka CMS Core v0.0.1)

Copy Markdown View Source

A MishkaGervaz custom table template: the list of drafts inside the page builder's Versions sheet.

It is the third block of MishkaCmsCoreWeb.Live.Admin.Builder.Panels.drafts_sheet/1 — the rows, their skeleton and their empty state. The "Save as" form and the name-collision banner above it are not a table and stay in Panels.

The template owns the whole list and nothing else: no filter bar, no selection, no pagination footer (features/0 is empty), because the sheet is 420px wide and the read is capped at one document's drafts. Its row buttons deliberately carry no phx-target, so open_draft, fork_draft and delete_draft reach MishkaCmsCoreWeb.Live.Admin.Builder.BuilderLive, which owns the editing session those events move.

Which row reads as "Editing" is not a property of the row — it is the editor's save target — so it travels in path_params[:editing_draft_id], the same channel the scoping source_*_id uses.

See MishkaCmsCore.Runtime.PageDraft, MishkaCmsCore.Runtime.LayoutDraft and MishkaCmsCore.Runtime.ErrorPageDraft, which point their presentation here.

Summary

Functions

The list: skeleton while the read is out, one row per draft, and the empty state when there are none.

One draft: open it, copy it, throw it away.

The skeleton drawn before the table has any state of its own.

Functions

render(assigns)

The list: skeleton while the read is out, one row per draft, and the empty state when there are none.

The stream container is display: contents so the rows stay flex children of the gap-1.5 column, and the empty state is a sibling of it rather than a child, because it is driven by @empty? (loaded AND zero rows) — "no drafts" and "not yet known" are different answers and the sheet gives neither one's markup to the other.

render_bulk_actions(assigns)

Callback implementation for MishkaGervaz.Table.Behaviours.Template.render_bulk_actions/1.

render_empty(assigns)

Callback implementation for MishkaGervaz.Table.Behaviours.Template.render_empty/1.

render_error(assigns)

Callback implementation for MishkaGervaz.Table.Behaviours.Template.render_error/1.

render_filters(assigns)

Callback implementation for MishkaGervaz.Table.Behaviours.Template.render_filters/1.

render_header(assigns)

Callback implementation for MishkaGervaz.Table.Behaviours.Template.render_header/1.

render_item(assigns)

One draft: open it, copy it, throw it away.

The row the editor is pointed at is marked four times over — border, tile, title weight and the "Editing" pill — because a single background tint is not enough to answer "where does the next save go" at a glance.

render_loading(assigns)

The skeleton drawn before the table has any state of its own.

It takes none of the table's assigns, because at this point there are none — @static and @state do not exist until the first load.

render_pagination(assigns)

Callback implementation for MishkaGervaz.Table.Behaviours.Template.render_pagination/1.

render_template_switcher(assigns)

Callback implementation for MishkaGervaz.Table.Behaviours.Template.render_template_switcher/1.