From 3dceb17085a6e16487d6c9c952b8fe70aa332689 Mon Sep 17 00:00:00 2001
From: shibao <%= add_links_to_content(@context.content) %>
" + end + ) + |> HTML.raw() + end +end diff --git a/lib/memex_web/components/note_card.ex b/lib/memex_web/components/note_card.ex deleted file mode 100644 index 3f306e0..0000000 --- a/lib/memex_web/components/note_card.ex +++ /dev/null @@ -1,29 +0,0 @@ -defmodule MemexWeb.Components.NoteCard do - @moduledoc """ - Display card for an note - """ - - use MemexWeb, :component - - def note_card(assigns) do - ~H""" -
<%= if @context.tags, do: @context.tags |> Enum.join(", ") %>
- + <.context_content context={@context} /><%= gettext("Visibility: %{visibility}", visibility: @context.visibility) %> diff --git a/priv/gettext/actions.pot b/priv/gettext/actions.pot index ac59067..4500be4 100644 --- a/priv/gettext/actions.pot +++ b/priv/gettext/actions.pot @@ -68,7 +68,7 @@ msgid "create invite" msgstr "" #: lib/memex_web/live/context_live/index.html.heex:49 -#: lib/memex_web/live/context_live/show.html.heex:41 +#: lib/memex_web/live/context_live/show.html.heex:34 #: lib/memex_web/live/note_live/index.html.heex:49 #: lib/memex_web/live/note_live/show.html.heex:38 #: lib/memex_web/live/pipeline_live/index.html.heex:49 @@ -83,7 +83,7 @@ msgid "delete user" msgstr "" #: lib/memex_web/live/context_live/index.html.heex:38 -#: lib/memex_web/live/context_live/show.html.heex:30 +#: lib/memex_web/live/context_live/show.html.heex:23 #: lib/memex_web/live/note_live/index.html.heex:38 #: lib/memex_web/live/note_live/show.html.heex:27 #: lib/memex_web/live/pipeline_live/index.html.heex:38 @@ -141,7 +141,7 @@ msgstr "" msgid "save" msgstr "" -#: lib/memex_web/live/context_live/show.html.heex:23 +#: lib/memex_web/live/context_live/show.html.heex:16 #: lib/memex_web/live/note_live/show.html.heex:23 #: lib/memex_web/live/pipeline_live/show.html.heex:23 #, elixir-autogen, elixir-format diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 02cc8af..718afde 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -80,7 +80,7 @@ msgstr "" msgid "Uses left" msgstr "" -#: lib/memex_web/live/context_live/show.html.heex:18 +#: lib/memex_web/live/context_live/show.html.heex:11 #: lib/memex_web/live/note_live/show.html.heex:18 #: lib/memex_web/live/pipeline_live/show.html.heex:18 #, elixir-autogen, elixir-format @@ -109,7 +109,6 @@ msgstr "" #: lib/memex_web/components/contexts_table_component.ex:48 #: lib/memex_web/components/notes_table_component.ex:48 -#: lib/memex_web/live/context_live/form_component.html.heex:23 #: lib/memex_web/live/note_live/form_component.html.heex:23 #, elixir-autogen, elixir-format msgid "content" @@ -385,11 +384,6 @@ msgstr "" msgid "visibility" msgstr "" -#: lib/memex_web/components/note_card.ex:18 -#, elixir-autogen, elixir-format -msgid "visibility: %{visibility}" -msgstr "" - #: lib/memex_web/live/note_live/index.ex:29 #, elixir-autogen, elixir-format msgid "new note" @@ -483,3 +477,8 @@ msgstr "" #, elixir-autogen, elixir-format msgid "home" msgstr "" + +#: lib/memex_web/live/context_live/form_component.html.heex:23 +#, elixir-autogen, elixir-format +msgid "use [[note-slug]] to link to a note" +msgstr "" diff --git a/priv/gettext/prompts.pot b/priv/gettext/prompts.pot index 00fbc40..3217299 100644 --- a/priv/gettext/prompts.pot +++ b/priv/gettext/prompts.pot @@ -142,7 +142,7 @@ msgid "are you sure you want to make %{invite_name} unlimited?" msgstr "" #: lib/memex_web/live/context_live/index.html.heex:46 -#: lib/memex_web/live/context_live/show.html.heex:38 +#: lib/memex_web/live/context_live/show.html.heex:31 #: lib/memex_web/live/note_live/index.html.heex:46 #: lib/memex_web/live/note_live/show.html.heex:35 #: lib/memex_web/live/pipeline_live/index.html.heex:46 diff --git a/test/memex_web/live/context_live_test.exs b/test/memex_web/live/context_live_test.exs index 5837cd7..782b714 100644 --- a/test/memex_web/live/context_live_test.exs +++ b/test/memex_web/live/context_live_test.exs @@ -1,8 +1,8 @@ defmodule MemexWeb.ContextLiveTest do use MemexWeb.ConnCase - import Phoenix.LiveViewTest - import Memex.ContextsFixtures + import Memex.{ContextsFixtures, NotesFixtures} + alias MemexWeb.Endpoint @create_attrs %{ "content" => "some content", @@ -132,4 +132,26 @@ defmodule MemexWeb.ContextLiveTest do refute has_element?(index_live, "#context-#{context.id}") end end + + describe "show with note" do + setup [:register_and_log_in_user] + + setup %{user: user} do + %{slug: note_slug} = note = note_fixture(user) + + [ + note: note, + context: + context_fixture(%{content: "example with backlink to [[#{note_slug}]] note"}, user) + ] + end + + test "displays context", %{conn: conn, context: context, note: %{slug: note_slug}} do + {:ok, show_live, html} = live(conn, Routes.context_show_path(conn, :show, context.slug)) + + assert html =~ "context" + assert html =~ Routes.note_show_path(Endpoint, :show, note_slug) + assert has_element?(show_live, "[data-qa=\"context-note-#{note_slug}\"]") + end + end end