From eff9890fceaad2675c29d7ab1b514c4a76c34428 Mon Sep 17 00:00:00 2001 From: Thelonius Kort Date: Thu, 19 Jan 2023 22:21:11 +0100 Subject: [PATCH] Add assign for the article_content --- lib/outlook_web/live/article_live/show.ex | 4 +++- lib/outlook_web/live/article_live/show.html.heex | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/outlook_web/live/article_live/show.ex b/lib/outlook_web/live/article_live/show.ex index 75f15b4..256d396 100644 --- a/lib/outlook_web/live/article_live/show.ex +++ b/lib/outlook_web/live/article_live/show.ex @@ -11,10 +11,12 @@ defmodule OutlookWeb.ArticleLive.Show do @impl true def handle_params(%{"id" => id}, _, socket) do + article = Articles.get_article_with_translations!(id) {:noreply, socket |> assign(:page_title, page_title(socket.assigns.live_action)) - |> assign(:article, Articles.get_article_with_translations!(id))} + |> assign(:article_content, InternalTree.garnish(article.content, %{tunits: %{class: "tunit"}})) + |> assign(:article, article)} end defp page_title(:show), do: "Show Article" diff --git a/lib/outlook_web/live/article_live/show.html.heex b/lib/outlook_web/live/article_live/show.html.heex index 6d9616c..0b83069 100644 --- a/lib/outlook_web/live/article_live/show.html.heex +++ b/lib/outlook_web/live/article_live/show.html.heex @@ -38,7 +38,7 @@
show boundaries hide boundaries - <.render_doc tree={@article.content} /> + <.render_doc tree={@article_content} />
<.link navigate={~p"/translations/new?article_id=#{@article.id}"}>New Translation