Refactor translation form_component

This commit is contained in:
Thelonius Kort
2023-01-19 22:39:09 +01:00
parent cf3a105a0f
commit f0c178cf31

View File

@ -2,7 +2,7 @@ defmodule OutlookWeb.TranslationLive.FormComponent do
use OutlookWeb, :live_component
alias Outlook.{Translations,InternalTree}
alias Outlook.InternalTree.TranslationUnit
alias Outlook.InternalTree.{TranslationUnit,Html}
@impl true
def render(assigns) do
@ -195,10 +195,8 @@ defmodule OutlookWeb.TranslationLive.FormComponent do
defp publish(translation_params, %{"publish" => "true"}, socket) do
translation_params
|> Map.put("public_content",
OutlookWeb.HtmlDocComponent.render_doc(%{tree: InternalTree.render_translation(socket.assigns.translation.article.content,
translation_params["content"]), tunit_tag: "span"})
|> Phoenix.HTML.Safe.to_iodata()
|> IO.iodata_to_binary())
InternalTree.render_translation(socket.assigns.translation.article.content, translation_params["content"])
|> Html.render_doc())
end
defp publish(translation_params, %{"publish" => "false"}, _) do
translation_params