Refactor translation form_component
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user