cannery/lib/cannery_web/templates/user_settings/edit.html.heex

163 lines
5.2 KiB
Plaintext
Raw Normal View History

2023-02-26 18:21:14 -05:00
<div class="mx-auto pb-8 max-w-3xl flex flex-col justify-center items-center text-right space-y-4">
2023-02-14 00:06:43 -05:00
<h1 class="pb-4 title text-primary-600 text-2xl text-center">
<%= gettext("Settings") %>
</h1>
2022-02-17 21:24:59 -05:00
<hr class="hr" />
2022-05-05 23:26:29 -04:00
<.form
:let={f}
2022-05-05 23:26:29 -04:00
for={@email_changeset}
action={Routes.user_settings_path(@conn, :update)}
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
>
2023-02-14 00:06:43 -05:00
<h3 class="title text-primary-600 text-lg text-center col-span-3">
2022-02-15 23:52:44 -05:00
<%= dgettext("actions", "Change email") %>
</h3>
2023-02-04 10:28:13 -05:00
<div
:if={@email_changeset.action && not @email_changeset.valid?()}
class="alert alert-danger col-span-3"
>
2023-02-14 00:06:43 -05:00
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
2023-02-04 10:28:13 -05:00
</div>
<%= hidden_input(f, :action, name: "action", value: "update_email") %>
2023-02-25 00:52:50 -05:00
<%= label(f, :email, gettext("Email"), class: "title text-lg text-primary-600") %>
2022-02-15 23:52:44 -05:00
<%= email_input(f, :email, required: true, class: "mx-2 my-1 input input-primary col-span-2") %>
<%= error_tag(f, :email, "col-span-3") %>
<%= label(f, :current_password, gettext("Current password"),
for: "current_password_for_email",
2022-02-17 22:29:01 -05:00
class: "mx-2 my-1 title text-lg text-primary-600"
2022-02-15 23:52:44 -05:00
) %>
<%= password_input(f, :current_password,
required: true,
name: "current_password",
id: "current_password_for_email",
class: "mx-2 my-1 input input-primary col-span-2"
) %>
<%= error_tag(f, :current_password, "col-span-3") %>
2022-02-17 21:24:59 -05:00
<%= submit(dgettext("actions", "Change email"),
2022-02-18 18:21:56 -05:00
class: "mx-auto btn btn-primary col-span-3"
2022-02-17 21:24:59 -05:00
) %>
2022-05-05 23:26:29 -04:00
</.form>
2022-02-17 21:24:59 -05:00
<hr class="hr" />
2022-05-05 23:26:29 -04:00
<.form
:let={f}
2022-05-05 23:26:29 -04:00
for={@password_changeset}
action={Routes.user_settings_path(@conn, :update)}
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
>
2023-02-14 00:06:43 -05:00
<h3 class="title text-primary-600 text-lg text-center col-span-3">
2022-02-15 23:52:44 -05:00
<%= dgettext("actions", "Change password") %>
</h3>
2023-02-04 10:28:13 -05:00
<div
:if={@password_changeset.action && not @password_changeset.valid?()}
class="alert alert-danger col-span-3"
>
2023-02-14 00:06:43 -05:00
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
2023-02-04 10:28:13 -05:00
</div>
<%= hidden_input(f, :action, name: "action", value: "update_password") %>
2022-02-17 22:29:01 -05:00
<%= label(f, :password, gettext("New password"), class: "title text-lg text-primary-600") %>
2022-02-15 23:52:44 -05:00
<%= password_input(f, :password,
required: true,
class: "mx-2 my-1 input input-primary col-span-2"
) %>
<%= error_tag(f, :password, "col-span-3") %>
<%= label(f, :password_confirmation, gettext("Confirm new password"),
2022-02-17 22:29:01 -05:00
class: "title text-lg text-primary-600"
2022-02-15 23:52:44 -05:00
) %>
<%= password_input(f, :password_confirmation,
required: true,
class: "mx-2 my-1 input input-primary col-span-2"
) %>
<%= error_tag(f, :password_confirmation, "col-span-3") %>
<%= label(f, :current_password, gettext("Current password"),
for: "current_password_for_password",
2022-02-17 22:29:01 -05:00
class: "title text-lg text-primary-600"
2022-02-15 23:52:44 -05:00
) %>
<%= password_input(f, :current_password,
required: true,
name: "current_password",
id: "current_password_for_password",
class: "mx-2 my-1 input input-primary col-span-2"
) %>
<%= error_tag(f, :current_password, "col-span-3") %>
2022-02-17 21:24:59 -05:00
<%= submit(dgettext("actions", "Change password"),
2022-02-18 18:21:56 -05:00
class: "mx-auto btn btn-primary col-span-3"
2022-02-17 21:24:59 -05:00
) %>
2022-05-05 23:26:29 -04:00
</.form>
<hr class="hr" />
<.form
:let={f}
2022-05-05 23:26:29 -04:00
for={@locale_changeset}
action={Routes.user_settings_path(@conn, :update)}
2023-02-14 00:06:43 -05:00
class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
2022-05-05 23:26:29 -04:00
>
2023-02-14 00:06:43 -05:00
<h3 class="title text-primary-600 text-lg text-center col-span-3">
2022-05-05 23:26:29 -04:00
<%= dgettext("actions", "Change Language") %>
</h3>
2023-02-04 10:28:13 -05:00
<div
:if={@locale_changeset.action && not @locale_changeset.valid?()}
2023-02-14 00:06:43 -05:00
class="alert alert-danger col-span-3"
2023-02-04 10:28:13 -05:00
>
2023-02-14 00:06:43 -05:00
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
2023-02-04 10:28:13 -05:00
</div>
2022-05-05 23:26:29 -04:00
<%= hidden_input(f, :action, name: "action", value: "update_locale") %>
<%= select(
f,
:locale,
2022-12-03 22:26:13 -05:00
[
{gettext("English"), "en_US"},
{gettext("German"), "de"},
{gettext("French"), "fr"},
{gettext("Spanish"), "es"}
],
2023-02-14 00:06:43 -05:00
class: "mx-2 my-1 min-w-md input input-primary col-span-3"
2022-05-05 23:26:29 -04:00
) %>
2023-02-14 00:06:43 -05:00
<%= error_tag(f, :locale, "col-span-3") %>
2022-05-05 23:26:29 -04:00
<%= submit(dgettext("actions", "Change language"),
2023-02-14 00:06:43 -05:00
class: "whitespace-nowrap mx-auto btn btn-primary col-span-3",
2022-05-05 23:26:29 -04:00
data: [qa: dgettext("prompts", "Are you sure you want to change your language?")]
) %>
</.form>
2022-02-17 21:24:59 -05:00
<hr class="hr" />
2022-02-15 23:52:44 -05:00
2022-11-09 23:33:50 -05:00
<div class="flex justify-center items-center">
<.link
href={Routes.export_path(@conn, :export, :json)}
class="mx-4 my-2 btn btn-primary"
target="_blank"
>
<%= dgettext("actions", "Export Data as JSON") %>
</.link>
<.link
href={Routes.user_settings_path(@conn, :delete, @current_user)}
method={:delete}
class="mx-4 my-2 btn btn-alert"
data-confirm={dgettext("prompts", "Are you sure you want to delete your account?")}
>
<%= dgettext("actions", "Delete User") %>
</.link>
</div>
</div>