memEx/lib/lokal_web/templates/user_settings/edit.html.heex

146 lines
4.7 KiB
Plaintext
Raw Normal View History

2022-05-05 21:07:02 -04:00
<div class="mx-auto mb-8 max-w-2xl flex flex-col justify-center items-center text-center space-y-4">
2022-02-25 21:39:22 -05:00
<h1 class="pb-4 title text-primary-600 text-xl">
<%= gettext("Settings") %>
2021-09-02 23:32:52 -04:00
</h1>
2022-02-25 21:39:22 -05:00
<hr class="hr" />
2022-05-05 20:55:59 -04:00
<.form
2023-01-26 00:28:34 -05:00
:let={f}
2022-05-05 20:55:59 -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"
>
2022-02-25 21:39:22 -05:00
<h3 class="title text-primary-600 text-lg col-span-3">
<%= dgettext("actions", "Change email") %>
</h3>
2023-02-04 09:16:51 -05:00
<div
:if={@email_changeset.action && not @email_changeset.valid?()}
class="alert alert-danger col-span-3"
>
<p>
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
</p>
</div>
2022-02-25 21:39:22 -05:00
2022-02-16 22:15:47 -05:00
<%= hidden_input(f, :action, name: "action", value: "update_email") %>
2022-02-25 21:39:22 -05:00
<%= label(f, :email, class: "title text-lg text-primary-600") %>
<%= 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",
class: "mx-2 my-1 title text-lg text-primary-600"
) %>
<%= 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") %>
<%= submit(dgettext("actions", "Change email"),
class: "mx-auto btn btn-primary col-span-3"
) %>
2022-05-05 20:55:59 -04:00
</.form>
2022-02-25 21:39:22 -05:00
<hr class="hr" />
2022-05-05 20:55:59 -04:00
<.form
2023-01-26 00:28:34 -05:00
:let={f}
2022-05-05 20:55:59 -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"
>
2022-02-25 21:39:22 -05:00
<h3 class="title text-primary-600 text-lg col-span-3">
<%= dgettext("actions", "Change password") %>
</h3>
2023-02-04 09:16:51 -05:00
<div
:if={@password_changeset.action && not @password_changeset.valid?()}
class="alert alert-danger col-span-3"
>
<p>
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
</p>
</div>
2022-02-25 21:39:22 -05:00
2022-02-16 22:15:47 -05:00
<%= hidden_input(f, :action, name: "action", value: "update_password") %>
2022-02-25 21:39:22 -05:00
<%= label(f, :password, gettext("New password"), class: "title text-lg text-primary-600") %>
<%= 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"),
class: "title text-lg text-primary-600"
) %>
<%= 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",
class: "title text-lg text-primary-600"
) %>
<%= 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") %>
<%= submit(dgettext("actions", "Change password"),
class: "mx-auto btn btn-primary col-span-3"
) %>
2022-05-05 20:55:59 -04:00
</.form>
<hr class="hr" />
<.form
2023-01-26 00:28:34 -05:00
:let={f}
2022-05-05 20:55:59 -04:00
for={@locale_changeset}
action={Routes.user_settings_path(@conn, :update)}
class="flex flex-col space-y-4 justify-center items-center"
>
<h3 class="title text-primary-600 text-lg">
<%= dgettext("actions", "Change Language") %>
</h3>
2023-02-04 09:16:51 -05:00
<p :if={@locale_changeset.action && not @locale_changeset.valid?} class="alert alert-danger">
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
</p>
2022-05-05 20:55:59 -04:00
<%= hidden_input(f, :action, name: "action", value: "update_locale") %>
<%= select(f, :locale, [{gettext("English"), "en_US"}, {"Spanish", "es"}],
class: "mx-2 my-1 min-w-md input input-primary"
) %>
<%= error_tag(f, :locale) %>
<%= submit(dgettext("actions", "Change language"),
class: "whitespace-nowrap mx-auto btn btn-primary",
data: [qa: dgettext("prompts", "Are you sure you want to change your language?")]
) %>
</.form>
2022-02-25 21:39:22 -05:00
<hr class="hr" />
2023-01-26 00:28:34 -05:00
<.link
href={Routes.user_settings_path(@conn, :delete, @current_user)}
method={:delete}
class="btn btn-alert"
data-confirm={dgettext("prompts", "Are you sure you want to delete your account?")}
>
<%= dgettext("actions", "Delete User") %>
</.link>
2022-02-16 22:15:47 -05:00
</div>