diff --git a/lib/chiya/channels.ex b/lib/chiya/channels.ex index 6205e43..c06e0db 100644 --- a/lib/chiya/channels.ex +++ b/lib/chiya/channels.ex @@ -9,9 +9,13 @@ defmodule Chiya.Channels do alias Chiya.Notes.Note @preloads [:notes] - @public_preloads [notes: (from n in Note, - where: not is_nil(n.published_at), - order_by: [desc: n.published_at])] + @public_preloads [ + notes: + from(n in Note, + where: not is_nil(n.published_at), + order_by: [desc: n.published_at] + ) + ] @doc """ Returns the list of channels. @@ -56,7 +60,7 @@ defmodule Chiya.Channels do Gets a single channel by its slug with all associated entities preloaded. """ def get_channel_by_slug!(slug), do: Repo.get_by!(Channel, slug: slug) - + @doc """ Creates a channel. diff --git a/lib/chiya/channels/channel.ex b/lib/chiya/channels/channel.ex index 0500e86..5d18d16 100644 --- a/lib/chiya/channels/channel.ex +++ b/lib/chiya/channels/channel.ex @@ -12,7 +12,7 @@ defmodule Chiya.Channels.Channel do many_to_many :notes, Chiya.Notes.Note, join_through: "channels_notes", join_keys: [channel: :id, note: :id] - + timestamps() end diff --git a/lib/chiya/notes.ex b/lib/chiya/notes.ex index ab8b783..571c4c6 100644 --- a/lib/chiya/notes.ex +++ b/lib/chiya/notes.ex @@ -21,7 +21,7 @@ defmodule Chiya.Notes do """ def list_notes do Note - |> order_by([n], [desc: n.updated_at, desc: n.published_at]) + |> order_by([n], desc: n.updated_at, desc: n.published_at) |> Repo.all() |> Repo.preload(@preloads) end @@ -67,9 +67,8 @@ defmodule Chiya.Notes do """ def get_note_preloaded!(id), do: Repo.get!(Note, id) |> preload_note() - - def get_note_by_slug_preloaded!(slug), do: Repo.get_by!(Note, slug: slug) |> preload_note() + def get_note_by_slug_preloaded!(slug), do: Repo.get_by!(Note, slug: slug) |> preload_note() @doc """ Creates a note. diff --git a/lib/chiya_web.ex b/lib/chiya_web.ex index ab785de..f64e95a 100644 --- a/lib/chiya_web.ex +++ b/lib/chiya_web.ex @@ -17,7 +17,8 @@ defmodule ChiyaWeb do those modules here. """ - def static_paths, do: ~w(assets fonts images favicon favicon.ico robots.txt browserconfig.xml site.webmanifest) + def static_paths, + do: ~w(assets fonts images favicon favicon.ico robots.txt browserconfig.xml site.webmanifest) def router do quote do diff --git a/lib/chiya_web/components/admin_components.ex b/lib/chiya_web/components/admin_components.ex index cd71075..4495d96 100644 --- a/lib/chiya_web/components/admin_components.ex +++ b/lib/chiya_web/components/admin_components.ex @@ -139,4 +139,4 @@ defmodule ChiyaWeb.AdminComponents do defp upload_error_to_string(:too_large), do: "Too large" defp upload_error_to_string(:too_many_files), do: "You have selected too many files" defp upload_error_to_string(:not_accepted), do: "You have selected an unacceptable file type" -end \ No newline at end of file +end diff --git a/lib/chiya_web/components/core_components.ex b/lib/chiya_web/components/core_components.ex index a17cf83..8113a4c 100644 --- a/lib/chiya_web/components/core_components.ex +++ b/lib/chiya_web/components/core_components.ex @@ -9,6 +9,7 @@ defmodule ChiyaWeb.CoreComponents do Icons are provided by [heroicons](https://heroicons.com). See `icon/1` for usage. """ use Phoenix.Component + use Phoenix.VerifiedRoutes, endpoint: ChiyaWeb.Endpoint, router: ChiyaWeb.Router, @@ -19,23 +20,13 @@ defmodule ChiyaWeb.CoreComponents do def favicon(assigns) do ~H""" - - - - - - - - """ - end - - - @doc """ - Renders a horizontal line - """ - def line(assigns) do - ~H""" -