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

155 lines
5.1 KiB
Plaintext
Raw Normal View History

2023-02-14 01:04:15 -05:00
<div class="mx-auto pb-8 max-w-3xl flex flex-col justify-center items-stretch text-right space-y-4">
<h1 class="title text-primary-400 text-xl text-left">
2022-11-17 22:30:01 -05:00
<%= 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
2022-11-16 21:11:02 -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"
>
2023-02-14 01:04:15 -05:00
<h3 class="title text-primary-400 text-lg text-center col-span-3">
2022-11-17 22:30:01 -05:00
<%= dgettext("actions", "change email") %>
2022-02-25 21:39:22 -05:00
</h3>
2023-02-04 11:29:06 -05:00
<div
:if={@email_changeset.action && not @email_changeset.valid?()}
class="alert alert-danger col-span-3"
>
2023-02-14 01:04:15 -05:00
<%= dgettext("errors", "oops, something went wrong! Please check the errors below") %>
2023-02-04 11:29:06 -05:00
</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
2022-11-17 22:30:01 -05:00
<%= label(f, :email, gettext("email"), class: "title text-lg text-primary-400") %>
2022-02-25 21:39:22 -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") %>
2022-11-17 22:30:01 -05:00
<%= label(f, :current_password, gettext("current password"),
2022-02-25 21:39:22 -05:00
for: "current_password_for_email",
2022-07-25 22:04:10 -04:00
class: "mx-2 my-1 title text-lg text-primary-400"
2022-02-25 21:39:22 -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-11-17 22:30:01 -05:00
<%= submit(dgettext("actions", "change email"),
2022-02-25 21:39:22 -05:00
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
2022-11-16 21:11:02 -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"
>
2023-02-14 01:04:15 -05:00
<h3 class="title text-primary-400 text-lg text-center col-span-3">
2022-11-17 22:30:01 -05:00
<%= dgettext("actions", "change password") %>
2022-02-25 21:39:22 -05:00
</h3>
2023-02-04 11:29:06 -05:00
<div
:if={@password_changeset.action && not @password_changeset.valid?()}
class="alert alert-danger col-span-3"
>
2023-02-14 01:04:15 -05:00
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
2023-02-04 11:29:06 -05:00
</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
2022-11-17 22:30:01 -05:00
<%= label(f, :password, gettext("new password"), class: "title text-lg text-primary-400") %>
2022-02-25 21:39:22 -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") %>
2022-11-17 22:30:01 -05:00
<%= label(f, :password_confirmation, gettext("confirm new password"),
2022-07-25 22:04:10 -04:00
class: "title text-lg text-primary-400"
2022-02-25 21:39:22 -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") %>
2022-11-17 22:30:01 -05:00
<%= label(f, :current_password, gettext("current password"),
2022-02-25 21:39:22 -05:00
for: "current_password_for_password",
2022-07-25 22:04:10 -04:00
class: "title text-lg text-primary-400"
2022-02-25 21:39:22 -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-11-17 22:30:01 -05:00
<%= submit(dgettext("actions", "change password"),
2022-02-25 21:39:22 -05:00
class: "mx-auto btn btn-primary col-span-3"
) %>
2022-05-05 20:55:59 -04:00
</.form>
<hr class="hr" />
<.form
2022-11-16 21:11:02 -05:00
:let={f}
2022-05-05 20:55:59 -04:00
for={@locale_changeset}
action={Routes.user_settings_path(@conn, :update)}
2023-02-14 01:04:15 -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 20:55:59 -04:00
>
2023-02-14 01:04:15 -05:00
<h3 class="title text-primary-400 text-lg text-center col-span-3">
2022-11-17 22:30:01 -05:00
<%= dgettext("actions", "change language") %>
2022-05-05 20:55:59 -04:00
</h3>
2023-02-04 11:29:06 -05:00
<div
:if={@locale_changeset.action && not @locale_changeset.valid?()}
2023-02-14 01:04:15 -05:00
class="alert alert-danger col-span-3"
2023-02-04 11:29:06 -05:00
>
2023-02-14 01:04:15 -05:00
<%= dgettext("errors", "oops, something went wrong! Please check the errors below") %>
2023-02-04 11:29:06 -05:00
</div>
2022-05-05 20:55:59 -04:00
<%= hidden_input(f, :action, name: "action", value: "update_locale") %>
2022-11-17 22:30:01 -05:00
<%= select(f, :locale, [{gettext("english"), "en_US"}, {"spanish", "es"}],
2023-02-14 01:04:15 -05:00
class: "mx-2 my-1 min-w-md input input-primary col-start-2"
2022-05-05 20:55:59 -04:00
) %>
2023-02-14 01:04:15 -05:00
<%= error_tag(f, :locale, "col-span-3") %>
2022-05-05 20:55:59 -04:00
2022-11-17 22:30:01 -05:00
<%= submit(dgettext("actions", "change language"),
2023-02-14 01:04:15 -05:00
class: "whitespace-nowrap mx-auto btn btn-primary col-span-3",
2022-11-17 22:30:01 -05:00
data: [qa: dgettext("prompts", "are you sure you want to change your language?")]
2022-05-05 20:55:59 -04:00
) %>
</.form>
2022-02-25 21:39:22 -05:00
<hr class="hr" />
2023-02-14 01:04:15 -05:00
<div class="flex justify-end items-center">
2022-12-20 19:15:08 -05:00
<.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>
2022-02-16 22:15:47 -05:00
</div>