MishkaCmsCoreWeb. Live. Admin. Components. MediaField
(Mishka CMS Core v0.0.1)
Copy Markdown
View Source
A form's picture field: the address the record stores, a preview of it, and the site's media
library under it — an upload dropped there, or a file chosen from it, fills the field. It is what
MishkaCmsCoreWeb.UIAdapters.Admin.text_input/1 draws for ui do extra %{media: :images} end,
with folder: "name" naming the library folder its uploads are filed in.
The address stays the form's field: it can still be typed, and saving reads it as any other. A
pick reaches the Gervaz form as the combobox's does, a combobox_select pushed to the form from
the browser, once the pick is drawn here. The library is
MishkaCmsCoreWeb.Live.Admin.Components.ContentMediaChooser, the content editor's own, closed
until it is asked for.
opened is the count of the form it is in (MishkaGervaz.Form.Web.State): a form opened again
drops a pick it has not taken, and draws the library closed again.
Outside a Gervaz form — the Settings page — select is how a pick or a clear reaches the form:
a function of the new address returning the Phoenix.LiveView.JS to run, and library: false
leaves the library out, for a field with no site to take files from.
It is its own component because it keeps which pick the form has yet to take.