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

Copy Markdown View Source

A MishkaGervaz custom table template: the saved-snippet list inside the page builder's Studio.

It owns the list and nothing around it. The "Save as snippet" box above it is a Gervaz FORM — MishkaCmsCoreWeb.Templates.SnippetForm — and both are mounted side by side from MishkaCmsCoreWeb.Live.Admin.Builder.Panels.

features/0 is empty on purpose: the Studio is a 520px sheet, and Gervaz's filter bar, selection checkboxes and pagination footer would each be a control the design does not have. The three scope chips ARE the table's :scope filter, drawn here in the sheet's idiom and pushed as the table's own filter event.

Insert and Delete are hand-drawn rather than row_actions, for two reasons: their DOM ids (pb-snippet-insert-<id>, pb-snippet-delete-<id>) are a contract the tests hold, and Gervaz's row actions would need a get action on the resource that does not exist. Neither carries a phx-target, so both reach BuilderLive, which owns inserting into the tree and deleting the row.

Every value a row shows beyond the name — the scope label, the block count, the byte size, the swatch tint, the relative time — is read off source by MishkaCmsCore.Runtime.PageBuilder.Snippets.row/1 rather than stored, so a row can never claim three blocks while holding one.

The swatch tint is one of the six Snippets picks from a name, and tint_class/1 turns it into a whole class rather than a style attribute — CSP has no nonce for an attribute, so style-src-attr can only be closed by there being none. Written out one clause per colour because Tailwind reads source text and an interpolated class name gets no rule at all, which is what MishkaCmsWeb.InterpolatedClassTest guards.

See MishkaCmsCore.Runtime.Snippet, which points its presentation here.

Summary

Functions

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_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.