MishkaBlogWeb.Live.Admin.Dashboard.Collection.Index (Mishka Blog v0.0.1)

Copy Markdown View Source

The collections grid: a Gervaz table drawn as MishkaBlogWeb.Templates.CollectionCard, its create/edit form, a modal that edits one language edition of a collection, and the version history of one collection, which switches between its language editions.

The page decodes the URL state, forwards PubSub broadcasts into the table component and closes the modals over the gervaz:exec-js bridge. The version history is MishkaBlogWeb.Live.Admin.Dashboard.VersionsModal.

See MishkaBlog.Collection for the table, filter and row-action definitions.

Summary

Functions

Every language edition of a collection, itself included, for the history modal's language row.

Callback implementation for Phoenix.LiveView.render/1.

Functions

editions_of(collection)

@spec editions_of(map()) :: [map()]

Every language edition of a collection, itself included, for the history modal's language row.

The variants relationship is a self-join on language_group_id, so it already contains the record it was loaded from — which is what this row wants, since the point is to switch between siblings and see which one you are on. A collection with no group has only itself, and the row then has nothing to offer, so it renders as one chip rather than a switch.

render(assigns)

Callback implementation for Phoenix.LiveView.render/1.