diff --git a/lib/chiya/notes.ex b/lib/chiya/notes.ex index e828698..ed0af2b 100644 --- a/lib/chiya/notes.ex +++ b/lib/chiya/notes.ex @@ -202,6 +202,8 @@ defmodule Chiya.Notes do %Note{} |> Note.changeset(attrs) |> Repo.insert() + |> Chiya.Tags.TagUpdater.update_tags(attrs) + |> Chiya.Notes.References.update_references(attrs) end @doc """ diff --git a/lib/chiya/tags/tag_updater.ex b/lib/chiya/tags/tag_updater.ex index fe9ad20..b5c334e 100644 --- a/lib/chiya/tags/tag_updater.ex +++ b/lib/chiya/tags/tag_updater.ex @@ -9,7 +9,9 @@ defmodule Chiya.Tags.TagUpdater do alias Chiya.Notes.Note def update_tags({:ok, %Note{} = note}, attrs) do - update_tags(note, attrs) + note + |> Notes.preload_note() + |> update_tags(attrs) {:ok, note} end diff --git a/lib/chiya_web/controllers/note_html/edit.html.heex b/lib/chiya_web/controllers/note_html/edit.html.heex index 7823614..755a318 100644 --- a/lib/chiya_web/controllers/note_html/edit.html.heex +++ b/lib/chiya_web/controllers/note_html/edit.html.heex @@ -1,5 +1,5 @@ <.header> - <%= @note.name %> + Edit Note “<%= @note.name %>” <:actions> <.link href={~p"/admin/notes/#{@note.id}"}> <.button><.icon name="hero-arrow-left" /> Back to Note @@ -7,14 +7,10 @@ - - <.note_form changeset={@changeset} action={~p"/admin/notes/#{@note}"} channels={@channels} selected_channels={@selected_channels} tags={@tags} -/> - -<.back navigate={~p"/admin/notes/#{@note.id}"}>Back to note +/> \ No newline at end of file diff --git a/lib/chiya_web/controllers/note_html/new.html.heex b/lib/chiya_web/controllers/note_html/new.html.heex index ab5aeea..82ba265 100644 --- a/lib/chiya_web/controllers/note_html/new.html.heex +++ b/lib/chiya_web/controllers/note_html/new.html.heex @@ -1,6 +1,11 @@ <.header> New Note <:subtitle>Use this form to manage note records in your database. + <:actions> + <.link href={~p"/admin/notes"}> + <.button><.icon name="hero-arrow-left" /> Back to Notes + + <.note_form @@ -9,6 +14,4 @@ channels={@channels} tags={@tags} selected_channels={@selected_channels} -/> - -<.back navigate={~p"/admin/notes"}>Back to notes +/> \ No newline at end of file diff --git a/lib/chiya_web/live/note_show_live.ex b/lib/chiya_web/live/note_show_live.ex index 5fa5650..8027d88 100644 --- a/lib/chiya_web/live/note_show_live.ex +++ b/lib/chiya_web/live/note_show_live.ex @@ -102,8 +102,6 @@ defmodule ChiyaWeb.NoteShowLive do <.button phx-disable-with="Changing...">Add Images - - <.back navigate={~p"/admin/notes"}>Back to notes """ end