An entry of the news: one thing the app has to say, in one or more
languages (Tayori.Translation).
:slug- its address on the public page, from the title of its first language unless the admin gives one.:categories- the keys of its categories (Tayori.Category).:cover- an optional image at the top of the entry and on its card, and its picture when a link to it is shared:%{"url" => ..., "key" => ..., "width" => ..., "height" => ..., "alt" => ...}.:segments- the readers it is for: an entry with no segments is for everyone, and is the only kind on the public page; an entry with segments is for the readers in at least one of them (seeTayori.Reader).:published_at- nil while it is a draft; a time in the future while it is scheduled.:pinned_at- when it was pinned: pinned entries come first.:announce-"popup","toast"or"banner": the entry is shown in the app as one, until:announce_until(the:announcementsfeature).:email- whether it is sent to the subscribers when it is published (the:subscriptionsfeature);:emailed_atonce it is.:author- who wrote it, as the admin's resolver gave them (%{"id" => ..., "name" => ...}).
:translation is not stored: the functions that read entries for a
reader set it to the translation in the reader's language, or in the
first language when the entry has none in theirs.
Summary
Functions
The ways an entry can be announced in the app.
Whether the entry is announced in the app at a time: announced as a popup, toast or banner, and its announcement not over.
A slug from a title: lowercase ASCII letters and digits, joined by dashes, with the accents taken off.
The status of an entry at a time (now by default).
The translation of an entry in a language, else in the first of
locales, else the first it has. Needs the translations preloaded.
Types
@type status() :: :draft | :scheduled | :published
@type t() :: %Tayori.Entry{ __meta__: term(), announce: String.t() | nil, announce_until: DateTime.t() | nil, announced_at: DateTime.t() | nil, author: map() | nil, categories: [String.t()], cover: map() | nil, email: boolean(), emailed_at: DateTime.t() | nil, id: Ecto.UUID.t() | nil, inserted_at: term(), pinned_at: DateTime.t() | nil, published_at: DateTime.t() | nil, segments: [String.t()], slug: String.t() | nil, translation: Tayori.Translation.t() | nil, translations: [Tayori.Translation.t()] | Ecto.Association.NotLoaded.t(), updated_at: term() }
Functions
@spec announce_kinds() :: [String.t()]
The ways an entry can be announced in the app.
@spec announcing?(t(), DateTime.t()) :: boolean()
Whether the entry is announced in the app at a time: announced as a popup, toast or banner, and its announcement not over.
A slug from a title: lowercase ASCII letters and digits, joined by dashes, with the accents taken off.
Examples
iex> Tayori.Entry.slugify("Ação rápida: exports in 2 clicks!")
"acao-rapida-exports-in-2-clicks"
@spec status(t(), DateTime.t()) :: status()
The status of an entry at a time (now by default).
Examples
iex> Tayori.Entry.status(%Tayori.Entry{published_at: nil})
:draft
iex> Tayori.Entry.status(%Tayori.Entry{published_at: ~U[2000-01-01 00:00:00Z]})
:published
@spec translation(t(), String.t() | nil, [String.t()]) :: Tayori.Translation.t() | nil
The translation of an entry in a language, else in the first of
locales, else the first it has. Needs the translations preloaded.