MishkaCmsCoreWeb. Live. Admin. Components. TranslationGroup
(Mishka CMS Core v0.0.1)
Copy Markdown
View Source
One word in every language — the body of the admin Translations modal and of the visual editor's
Translations sheet alike. A chip per language with its translation, or "Missing", beside it, and
Gervaz's MishkaCmsCore.Runtime.Translation form for the one picked.
Both pages keep the group in :translation_group and move it only through these, so the two
cannot drift apart:
open/2— a row's Translate: the key of that row, the first missing language pickedpick/2— a click on a languagesaved/1— after the form saves: read again, and on to the next missing languageadd_language/2— the word in one more language, published on its site first if need beclose/1
The picker sends "translation_pick" to the page with the row's id, and the add row
"translation_add_language" with the typed language.
Summary
Functions
Adds language to the open word — see Translations.add_language/4 for who may, and for the
master's bounds — and picks the new language's row. A refusal is a flash, the word unchanged.
Closes the open key.
Opens the key the row id belongs to, the first language still missing picked.
Picks the language row id, if it is one of the open key's.
Reads the open key again after a save, and picks the next language still missing after the one just saved — or keeps it, when none is.
The key's languages and the form for the picked one — or, for a word the reader may not write, its value to read.
Functions
@spec add_language(Phoenix.LiveView.Socket.t(), String.t()) :: Phoenix.LiveView.Socket.t()
Adds language to the open word — see Translations.add_language/4 for who may, and for the
master's bounds — and picks the new language's row. A refusal is a flash, the word unchanged.
@spec close(Phoenix.LiveView.Socket.t()) :: Phoenix.LiveView.Socket.t()
Closes the open key.
@spec open(Phoenix.LiveView.Socket.t(), String.t()) :: Phoenix.LiveView.Socket.t()
Opens the key the row id belongs to, the first language still missing picked.
@spec pick(Phoenix.LiveView.Socket.t(), String.t()) :: Phoenix.LiveView.Socket.t()
Picks the language row id, if it is one of the open key's.
@spec saved(Phoenix.LiveView.Socket.t()) :: Phoenix.LiveView.Socket.t()
Reads the open key again after a save, and picks the next language still missing after the one just saved — or keeps it, when none is.
The key's languages and the form for the picked one — or, for a word the reader may not write, its value to read.
Attributes
id(:string) (required)group(:map) (required)current_user(:any) (required)