Add status preview in translation_live/show
This commit is contained in:
@ -10,10 +10,18 @@ defmodule OutlookWeb.TranslationLive.Show do
|
||||
|
||||
@impl true
|
||||
def handle_params(%{"id" => id}, _, socket) do
|
||||
translation = Translations.get_translation!(id)
|
||||
{:noreply,
|
||||
socket
|
||||
|> assign(:page_title, page_title(socket.assigns.live_action))
|
||||
|> assign(:translation, Translations.get_translation!(id))}
|
||||
|> assign(:translation, translation)
|
||||
|> assign(:translation_tree,
|
||||
InternalTree.render_translation(
|
||||
translation.article.content, translation.content
|
||||
) |> InternalTree.garnish(
|
||||
%{tunits: %{status: fn n -> n.status end, class: :tunit}}
|
||||
)
|
||||
)}
|
||||
end
|
||||
|
||||
defp page_title(:show), do: "Show Translation"
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
<:item title="Unauthorized"><%= @translation.unauthorized %></:item>
|
||||
</.list>
|
||||
|
||||
<div class="article">
|
||||
<.render_doc tree={InternalTree.render_translation(@translation.article.content, @translation.content)} />
|
||||
<div class="article show_status">
|
||||
<.render_doc tree={@translation_tree} />
|
||||
</div>
|
||||
|
||||
<.back navigate={~p"/articles/#{@translation.article}"}>Back to <article></article></.back>
|
||||
|
||||
Reference in New Issue
Block a user