mix format

This commit is contained in:
Inhji 2023-04-10 19:22:28 +02:00
parent ebacb7919c
commit 83aac55273
6 changed files with 15 additions and 13 deletions

View file

@ -31,7 +31,7 @@ defmodule Chiya.Notes.Note do
join_through: Chiya.Notes.NoteNote, join_through: Chiya.Notes.NoteNote,
join_keys: [source_id: :id, target_id: :id] join_keys: [source_id: :id, target_id: :id]
many_to_many :tags, Chiya.Tags.Tag, many_to_many :tags, Chiya.Tags.Tag,
join_through: Chiya.Notes.NoteTag, join_through: Chiya.Notes.NoteTag,
join_keys: [note_id: :id, tag_id: :id] join_keys: [note_id: :id, tag_id: :id]

View file

@ -128,7 +128,6 @@ defmodule Chiya.Notes.References do
else else
Logger.debug("Note '#{slug}' does not exist anymore.") Logger.debug("Note '#{slug}' does not exist anymore.")
end end
end) end)
end end

View file

@ -75,11 +75,12 @@ defmodule ChiyaWeb.NoteController do
|> redirect(to: ~p"/admin/notes/#{note}") |> redirect(to: ~p"/admin/notes/#{note}")
{:error, %Ecto.Changeset{} = changeset} -> {:error, %Ecto.Changeset{} = changeset} ->
render(conn, :edit, render(conn, :edit,
note: note, note: note,
changeset: changeset, changeset: changeset,
channels: to_channel_options(), channels: to_channel_options(),
tags: note.tags) tags: note.tags
)
end end
end end

View file

@ -13,9 +13,7 @@ defmodule ChiyaWeb.NoteHTML do
def note_form(assigns) def note_form(assigns)
def selected_channels(changeset), do: def selected_channels(changeset), do: Enum.map(changeset.data.channels, fn c -> c.id end)
Enum.map(changeset.data.channels, fn c -> c.id end)
def tags_to_string(tags), do: def tags_to_string(tags), do: Enum.map_join(tags, ", ", fn t -> t.name end)
Enum.map_join(tags, ", ", fn t -> t.name end)
end end

View file

@ -3,6 +3,11 @@
<:subtitle>Use this form to manage note records in your database.</:subtitle> <:subtitle>Use this form to manage note records in your database.</:subtitle>
</.header> </.header>
<.note_form changeset={@changeset} action={~p"/admin/notes/#{@note}"} channels={@channels} tags={@tags} /> <.note_form
changeset={@changeset}
action={~p"/admin/notes/#{@note}"}
channels={@channels}
tags={@tags}
/>
<.back navigate={~p"/admin/notes"}>Back to notes</.back> <.back navigate={~p"/admin/notes"}>Back to notes</.back>

View file

@ -28,4 +28,3 @@
<.button>Save Note</.button> <.button>Save Note</.button>
</:actions> </:actions>
</.simple_form> </.simple_form>