Add toggling fields in translation form

This commit is contained in:
Thelonius Kort
2023-05-04 18:14:44 +02:00
parent d53eceb7a0
commit 698da7f8b7

View File

@ -14,6 +14,7 @@ defmodule OutlookWeb.TranslationLive.FormComponent do
<:subtitle>Use this form to manage translation records in your database.</:subtitle>
</.header>
<div phx-click={JS.toggle(to: ".more-fields")} class="cursor-pointer">more/less fields</div>
<.simple_form
:let={f}
for={@changeset}
@ -23,9 +24,12 @@ defmodule OutlookWeb.TranslationLive.FormComponent do
phx-submit="save"
>
<.input field={{f, :article_id}} type="hidden" />
<div class="more-fields">
<.input field={{f, :language}} type="select" label="language"
options={Application.get_env(:outlook,:deepl)[:target_langs]} />
</div>
<.input field={{f, :title}} type="text" label="title" />
<div class="more-fields">
<.input field={{f, :teaser}} type="textarea" label="teaser" class="h-28" />
<.input field={{f, :date}} type="datetime-local" label="date" />
<div class="flex items-center justify-between">
@ -33,6 +37,7 @@ defmodule OutlookWeb.TranslationLive.FormComponent do
<.input field={{f, :unauthorized}} type="checkbox" label="unauthorized" />
</div>
<.input field={{f, :remarks}} type="textarea" label="remarks" class="h-28" />
</div>
<input type="hidden" id="continue_edit" name="continue_edit" value="false" />
<input type="hidden" id="publish" name="publish" value="false" />
<:actions>