commit
d42f53e271
7 changed files with 17 additions and 15 deletions
|
@ -128,7 +128,6 @@ defmodule Chiya.Notes.References do
|
|||
else
|
||||
Logger.debug("Note '#{slug}' does not exist anymore.")
|
||||
end
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ defmodule Chiya.Tags.TagUpdater do
|
|||
Logger.debug("Looking up tag [#{tag}] with slug [#{slug}]")
|
||||
|
||||
{:ok, tag} =
|
||||
case Tags.get_tag(slug) do
|
||||
case Tags.get_tag_by_slug(slug) do
|
||||
nil ->
|
||||
Logger.debug("Tag [#{tag}] does not exist. Creating.")
|
||||
Tags.create_tag(%{name: tag})
|
||||
|
@ -96,7 +96,7 @@ defmodule Chiya.Tags.TagUpdater do
|
|||
defp remove_tag(schema, tag) do
|
||||
slug = Slugger.slugify_downcase(tag)
|
||||
|
||||
if tag = Tags.get_tag(slug) do
|
||||
if tag = Tags.get_tag_by_slug(slug) do
|
||||
case schema do
|
||||
%Note{} ->
|
||||
attrs = %{tag_id: tag.id, note_id: schema.id}
|
||||
|
|
|
@ -79,7 +79,8 @@ defmodule ChiyaWeb.NoteController do
|
|||
note: note,
|
||||
changeset: changeset,
|
||||
channels: to_channel_options(),
|
||||
tags: note.tags)
|
||||
tags: note.tags
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -13,9 +13,7 @@ defmodule ChiyaWeb.NoteHTML do
|
|||
|
||||
def note_form(assigns)
|
||||
|
||||
def selected_channels(changeset), do:
|
||||
Enum.map(changeset.data.channels, fn c -> c.id end)
|
||||
def selected_channels(changeset), do: Enum.map(changeset.data.channels, fn c -> c.id end)
|
||||
|
||||
def tags_to_string(tags), do:
|
||||
Enum.map_join(tags, ", ", fn t -> t.name end)
|
||||
def tags_to_string(tags), do: Enum.map_join(tags, ", ", fn t -> t.name end)
|
||||
end
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
<:subtitle>Use this form to manage note records in your database.</:subtitle>
|
||||
</.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>
|
||||
|
|
|
@ -28,4 +28,3 @@
|
|||
<.button>Save Note</.button>
|
||||
</:actions>
|
||||
</.simple_form>
|
||||
|
||||
|
|
Loading…
Reference in a new issue