diff --git a/lib/bdfr_browser/message.ex b/lib/bdfr_browser/message.ex index 83480a3..ff4f96c 100644 --- a/lib/bdfr_browser/message.ex +++ b/lib/bdfr_browser/message.ex @@ -12,6 +12,7 @@ defmodule BdfrBrowser.Message do field :author, :string field :message, :string field :posted_at, :utc_datetime + field :bookmark, :string belongs_to :chat, Chat end diff --git a/priv/repo/migrations/20230821110436_add_chat_message_bookmarks.exs b/priv/repo/migrations/20230821110436_add_chat_message_bookmarks.exs new file mode 100644 index 0000000..acaf9b1 --- /dev/null +++ b/priv/repo/migrations/20230821110436_add_chat_message_bookmarks.exs @@ -0,0 +1,9 @@ +defmodule BdfrBrowser.Repo.Migrations.AddChatMessageBookmarks do + use Ecto.Migration + + def change do + alter table("messages") do + add :bookmark, :string + end + end +end diff --git a/priv/templates/http/chat.eex b/priv/templates/http/chat.eex index 65ccd53..364a909 100644 --- a/priv/templates/http/chat.eex +++ b/priv/templates/http/chat.eex @@ -1,7 +1,12 @@

Chats

<%= for message <- messages do %> -
+
+ data-bookmark="<%= message.bookmark %>" + <% end %> + >
@@ -10,9 +15,31 @@
<%= message.author %>, <%= DateTime.to_iso8601(message.posted_at) %> + + <%= unless is_nil(message.bookmark) do %> + <%= message.bookmark %> + <% end %>
<% end %> + +