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

Copy Markdown View Source

Everything the builder's Assets sheet draws around its files, shared by both of its views.

MishkaCmsCoreWeb.Templates.AssetsGrid and MishkaCmsCoreWeb.Templates.AssetsList differ in one thing — whether a file is a card or a row. The toolbar, the select-all, the bulk bar, the empty state and the load-more are the same on both, and were the same in two copies until the second view existed to prove it.

Why the sheet does not use Gervaz's own Table for its list

It did, and the reader could not see half of it. MishkaGervaz.Table.Templates.Table draws a PAGE: a filter bar with Search, Type, Site, Featured and the archive switch laid out across the width, then a multi-column table with its own header. The sheet is 620px of overlay with a folder rail down one side, so all of that ran off the right edge — the filters, the Type column, the actions. Nothing was broken; it was simply drawn for a surface four times as wide.

So the sheet has two templates of its own, and both wear this chrome: one control (search), the switcher, and the folders answering in the rail what Type and Site would have answered in a bar.

See MishkaGervaz.Table.Web.State.apply_presentation/2 for how a mount chooses them.

Summary

Functions

Nothing here, and the way to ask for the next page.

The next page, drawn by Gervaz exactly as the Media library draws it.

Select-all and the bulk bar, compacted for the sheet.

Search and the view switch, the sheet's whole filter bar.

Functions

empty(assigns)

Nothing here, and the way to ask for the next page.

Attributes

  • static (:map) (required)
  • state (:map) (required)
  • myself (:any) (required)
  • empty? (:boolean) (required)

pagination(assigns)

The next page, drawn by Gervaz exactly as the Media library draws it.

This was a hand-rolled "Show more files" button, which meant the sheet had its own idea of paging — no count, no loading state, and nothing if the resource ever switched from :load_more to numbered pages. Shared.render_pagination/1 reads the resource's pagination do … end and answers whatever it says, so the two surfaces page the same way for the same reason.

Only the size is ours: the wrapper's descendant utilities bring the page's control down to the sheet's.

Attributes

  • static (:map) (required)
  • state (:map) (required)
  • myself (:any) (required)

selection(assigns)

Select-all and the bulk bar, compacted for the sheet.

Shared.render_bulk_actions/1 forwards no class, so the bar arrives at the page's size; the wrapper's descendant utilities bring it down. They win on specificity without ! — [&>div]:mb-0 is .…>div, one class more than the .mb-[14px] it overrides.

Attributes

  • static (:map) (required)
  • state (:map) (required)
  • myself (:any) (required)
  • show_checkboxes (:boolean) (required)
  • show_bulk_actions (:boolean) (required)

toolbar(assigns)

Search and the view switch, the sheet's whole filter bar.

Both are the library's own controls — the adapter's text_input in its filter variant and Shared.render_template_switcher/1 — so the two surfaces read as one product.

Attributes

  • static (:map) (required)
  • state (:map) (required)
  • myself (:any) (required)