diff --git a/lib/chiya/channels.ex b/lib/chiya/channels.ex index c06e0db..f3afefd 100644 --- a/lib/chiya/channels.ex +++ b/lib/chiya/channels.ex @@ -10,11 +10,13 @@ defmodule Chiya.Channels do @preloads [:notes] @public_preloads [ - notes: + notes: { from(n in Note, where: not is_nil(n.published_at), order_by: [desc: n.published_at] - ) + ), + Chiya.Notes.note_preloads() + } ] @doc """ diff --git a/lib/chiya/notes.ex b/lib/chiya/notes.ex index 124ed4c..e4110a4 100644 --- a/lib/chiya/notes.ex +++ b/lib/chiya/notes.ex @@ -8,6 +8,7 @@ defmodule Chiya.Notes do alias Chiya.Notes.{Note, NoteImage, NoteNote, NoteTag} @preloads [:channels, :images, :links_from, :links_to, :tags] + def note_preloads(), do: @preloads @doc """ Returns the list of notes. diff --git a/lib/chiya_web.ex b/lib/chiya_web.ex index 330ed59..6de6716 100644 --- a/lib/chiya_web.ex +++ b/lib/chiya_web.ex @@ -68,6 +68,9 @@ defmodule ChiyaWeb do quote do use Phoenix.LiveComponent + # Import admin components + import ChiyaWeb.AdminComponents + unquote(html_helpers()) end end @@ -80,11 +83,11 @@ defmodule ChiyaWeb do import Phoenix.Controller, only: [get_csrf_token: 0, view_module: 1, view_template: 1] - # Include general helpers for rendering HTML - unquote(html_helpers()) - # Import admin components import ChiyaWeb.AdminComponents + + # Include general helpers for rendering HTML + unquote(html_helpers()) end end @@ -96,11 +99,11 @@ defmodule ChiyaWeb do import Phoenix.Controller, only: [get_csrf_token: 0, view_module: 1, view_template: 1] - # Include general helpers for rendering HTML - unquote(html_helpers()) - # Import public components import ChiyaWeb.PublicComponents + + # Include general helpers for rendering HTML + unquote(html_helpers()) end end diff --git a/lib/chiya_web/components/public_components.ex b/lib/chiya_web/components/public_components.ex index ef5689d..b9acf55 100644 --- a/lib/chiya_web/components/public_components.ex +++ b/lib/chiya_web/components/public_components.ex @@ -11,7 +11,34 @@ defmodule ChiyaWeb.PublicComponents do """ def line(assigns) do ~H""" -
+ <%= render_slot(@subtitle) %> +
+