diff --git a/assets/css/app.css b/assets/css/app.css index 4d06503..933fef4 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -140,7 +140,7 @@ .footnote:before { content: '{'; } .footnote:after { content: '}'; } - body > header nav a { + a.button { @apply inline-block text-theme-base px-3 py-2.5 border border-theme-background1 hover:bg-theme-background1 rounded transition font-semibold; } } \ No newline at end of file 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/components/core_components.ex b/lib/chiya_web/components/core_components.ex index 0f97b11..50465db 100644 --- a/lib/chiya_web/components/core_components.ex +++ b/lib/chiya_web/components/core_components.ex @@ -30,9 +30,10 @@ defmodule ChiyaWeb.CoreComponents do """ end + attr :class, :string, default: nil def darkmode_toggle(assigns) do ~H""" - <.link href="#" id="dark-mode-toggle" class="text-sm leading-6"> + <.link href="#" id="dark-mode-toggle" class={["text-sm leading-6", @class]}> ☀️ diff --git a/lib/chiya_web/components/layouts/root_public.html.heex b/lib/chiya_web/components/layouts/root_public.html.heex index 89da245..517df70 100644 --- a/lib/chiya_web/components/layouts/root_public.html.heex +++ b/lib/chiya_web/components/layouts/root_public.html.heex @@ -42,30 +42,30 @@ diff --git a/lib/chiya_web/controllers/note_html/edit.html.heex b/lib/chiya_web/controllers/note_html/edit.html.heex index bb40517..755a318 100644 --- a/lib/chiya_web/controllers/note_html/edit.html.heex +++ b/lib/chiya_web/controllers/note_html/edit.html.heex @@ -1,6 +1,10 @@ <.header> - Edit Note <%= @note.id %> - <:subtitle>Use this form to manage note records in your database. + Edit Note “<%= @note.name %>” + <:actions> + <.link href={~p"/admin/notes/#{@note.id}"}> + <.button><.icon name="hero-arrow-left" /> Back to Note + + <.note_form @@ -9,6 +13,4 @@ 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/controllers/note_html/note_form.html.heex b/lib/chiya_web/controllers/note_html/note_form.html.heex index d853c62..f176af6 100644 --- a/lib/chiya_web/controllers/note_html/note_form.html.heex +++ b/lib/chiya_web/controllers/note_html/note_form.html.heex @@ -2,8 +2,14 @@ <.error :if={@changeset.action}> Oops, something went wrong! Please check the errors below. - <.input field={f[:name]} type="text" label="Name" /> - <.input field={f[:content]} type="textarea" label="Content" rows="15" /> + + <.input field={f[:name]} type="text" /> + <.input field={f[:content]} + type="textarea" + label="Content" + rows="15" + class="font-mono" + /> <.input field={f[:slug]} type="text" label="Slug" /> <.input field={f[:published_at]} type="datetime-local" label="Published at" /> <.input diff --git a/lib/chiya_web/controllers/page_html/home.html.heex b/lib/chiya_web/controllers/page_html/home.html.heex index b83ccc8..0f57a06 100644 --- a/lib/chiya_web/controllers/page_html/home.html.heex +++ b/lib/chiya_web/controllers/page_html/home.html.heex @@ -7,19 +7,13 @@