# `MishkaCmsCoreWeb.Templates.AssetsGrid`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core_web/templates/assets_grid.ex#L5)

A MishkaGervaz table template: the file grid in the builder's Assets sheet.

## Why the sheet has its own template at all

It is the same resource as the Media library and deliberately the same CARD — a file should not
look like two different things depending on which screen you found it on, so `render_item/1` is
`MishkaGervaz.Table.Templates.MediaGallery`'s, unchanged. What differs is everything around the
card, because the two surfaces are not the same shape:

  * The library is a page. It can afford a filter bar with Type, Site, Featured and the archive
    switch, all laid out across the width.
  * The sheet is 620px of overlay with a folder rail down one side and a dropzone at the top.
    There is room for one control, and the one that earns it is search. The folders answer the
    question Type and Site would have answered, and they answer it in the sidebar where the reader
    is already looking.

Nothing here removes those filters from the resource; they are simply not drawn on this surface.

## How it gets chosen

`MishkaGervaz.Table.Web.Live` takes a `template` assign — see
`MishkaGervaz.Table.Web.State.apply_presentation/2`. The Media library passes none and keeps its
own; the sheet passes this one. One resource, two surfaces, no fork.

## Nothing here is drawn twice

The search box is the adapter's `text_input` in its filter variant and the view switch is
`Shared.render_template_switcher/1` — the same two controls the library's own filter bar draws.
Both were hand-rolled here first, and both drifted: a 34px search box beside a 42px one, and a
switcher whose active tab was a filled violet square where the library's is a white pill.

## The card's footer while a pick is in flight

A card is about 185px wide in the sheet, and its footer is one row: the labelled button, then every
other action as a 30px square. With a pick in flight that is `Use` and three squares, which leaves
the button about 50px — its glyph, the gap and its padding take most of that, and the label came
out as "U…". The footer wraps while a `Use` button is in it, and the button takes the whole of its
first row, so the label has the card's width however long a language writes it and the squares sit
under it. A card with no `Use` in it matches neither rule and is the Media page's card. Both rules
are written out in `render/1` rather than assembled, because Tailwind reads class names off the
source text, and their `\_` is Tailwind's way of keeping the underscore of `use_media` from
becoming a space.

## Which clicks go where

`filter`, `load_more` and `switch_template` are Gervaz's own events and carry
`phx-target={@myself}`. Everything the EDITOR owns — using a file in the document, the folder rail
— is the parent LiveView's and carries no target.

# `picking_options`

```elixir
@spec picking_options(map()) :: keyword()
```

Which action the card gives its one labelled slot to, for a given table state.

`[]` — no opinion, so the card keeps the Media page's defaults — unless something in the editor is
waiting for a file, which `editor_pick_node` is the signal for. It is the same param that makes the
`Use` action visible at all, so the two can never disagree about whether a pick is in flight.

# `render_bulk_actions`

# `render_empty`

# `render_error`

# `render_filters`

# `render_header`

# `render_item`

The shared media card, with ONE thing decided differently while a pick is in progress.

A card has room for exactly one action that says what it does in words; the rest are glyphs
(see `MishkaGervaz.Table.Templates.MediaGallery.split_actions/3`). That slot defaults to Edit,
which is right on the Media page — and wrong here, because on this surface the reader did not come
to edit a file, they came to put one in the document. `Use` was in the glyph row, unlabelled,
beside Preview, Edit and Archive, so the sheet said "Choosing for image" and then gave no visible
answer to "how?". Reported on the editor issue as "there is no way at all to tell how to bring it
into the navbar".

Only while something is actually waiting for a file: with no pick in flight the `Use` action is not
rendered at all (`MishkaCmsCore.Runtime.Media` hides it), so the slot goes back to Edit and the
card is the Media page's card again.

# `render_pagination`

# `render_template_switcher`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
