Add Translations

mix phx.gen.live Translations Translation translations \
  lang:string title:string teaser:text content:map \
  date:utc_datetime user_id:references:users \
  public:boolean unauthorized:boolean article_id:references:articles
This commit is contained in:
Thelonius Kort
2022-12-26 18:45:40 +01:00
parent f7f1e1a284
commit f66521dba8
13 changed files with 600 additions and 0 deletions

View File

@ -0,0 +1,45 @@
<.header>
Listing Translations
<:actions>
<.link patch={~p"/translations/new"}>
<.button>New Translation</.button>
</.link>
</:actions>
</.header>
<.table id="translations" rows={@translations} row_click={&JS.navigate(~p"/translations/#{&1}")}>
<:col :let={translation} label="Lang"><%= translation.lang %></:col>
<:col :let={translation} label="Title"><%= translation.title %></:col>
<:col :let={translation} label="Teaser"><%= translation.teaser %></:col>
<:col :let={translation} label="Content"><%= translation.content %></:col>
<:col :let={translation} label="Date"><%= translation.date %></:col>
<:col :let={translation} label="Public"><%= translation.public %></:col>
<:col :let={translation} label="Unauthorized"><%= translation.unauthorized %></:col>
<:action :let={translation}>
<div class="sr-only">
<.link navigate={~p"/translations/#{translation}"}>Show</.link>
</div>
<.link patch={~p"/translations/#{translation}/edit"}>Edit</.link>
</:action>
<:action :let={translation}>
<.link phx-click={JS.push("delete", value: %{id: translation.id})} data-confirm="Are you sure?">
Delete
</.link>
</:action>
</.table>
<.modal
:if={@live_action in [:new, :edit]}
id="translation-modal"
show
on_cancel={JS.navigate(~p"/translations")}
>
<.live_component
module={OutlookWeb.TranslationLive.FormComponent}
id={@translation.id || :new}
title={@page_title}
action={@live_action}
translation={@translation}
navigate={~p"/translations"}
/>
</.modal>