29 lines
746 B
Elixir
29 lines
746 B
Elixir
defmodule OutlookWeb.TranslationLive.Edit do
|
|
use OutlookWeb, :live_view
|
|
|
|
alias Outlook.Articles
|
|
alias Outlook.Translations
|
|
|
|
@impl true
|
|
def render(assigns) do
|
|
~H"""
|
|
<.live_component
|
|
module={OutlookWeb.TranslationLive.FormComponent}
|
|
id={:new}
|
|
title="New Translation"
|
|
action={@live_action}
|
|
translation={@translation}
|
|
translation_content={@translation_content}
|
|
navigate={~p"/translations"}
|
|
/>
|
|
"""
|
|
end
|
|
|
|
@impl true
|
|
def mount(%{"id" => id} = _params, _session, socket) do
|
|
socket = socket
|
|
|> assign_new(:translation, fn -> Translations.get_translation!(id) end)
|
|
{:ok, assign_new(socket, :translation_content, fn -> socket.assigns.translation.content end)}
|
|
end
|
|
end
|