forked from shibao/cannery
gettext and heex user registration pages
This commit is contained in:
@ -1,89 +0,0 @@
|
||||
<div class="mb-8 flex flex-col justify-center items-center space-y-8">
|
||||
<h1 class="title text-primary-500 text-xl">
|
||||
Settings
|
||||
</h1>
|
||||
|
||||
<h3 class="title text-primary-500 text-lg">
|
||||
Change email
|
||||
</h3>
|
||||
|
||||
<%= form_for @email_changeset, Routes.user_settings_path(@conn, :update),
|
||||
[class: "flex flex-col justify-center items-center space-y-4"], fn f -> %>
|
||||
<%= if @email_changeset.action do %>
|
||||
<div class="alert alert-danger">
|
||||
<p>Oops, something went wrong! Please check the errors below.</p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= hidden_input f, :action, name: "action", value: "update_email" %>
|
||||
|
||||
<div class="grid grid-cols-3 justify-center items-center text-center space-x-4">
|
||||
<%= label f, :email, class: "title text-lg text-primary-500" %>
|
||||
<%= email_input f, :email, required: true, class: "input input-primary col-span-2" %>
|
||||
</div>
|
||||
<%= error_tag f, :email %>
|
||||
|
||||
<div class="grid grid-cols-3 justify-center items-center text-center space-x-4">
|
||||
<%= label f, :current_password, for: "current_password_for_email", class: "title text-lg text-primary-500" %>
|
||||
<%= password_input f, :current_password,
|
||||
required: true,
|
||||
name: "current_password",
|
||||
id: "current_password_for_email",
|
||||
class: "input input-primary col-span-2" %>
|
||||
</div>
|
||||
<%= error_tag f, :current_password %>
|
||||
|
||||
<%= submit "Change email", class: "btn btn-primary" %>
|
||||
<% end %>
|
||||
|
||||
<h3 class="title text-primary-500 text-lg">
|
||||
Change password
|
||||
</h3>
|
||||
|
||||
<%= form_for @password_changeset, Routes.user_settings_path(@conn, :update),
|
||||
[class: "flex flex-col justify-center items-center space-y-4"], fn f -> %>
|
||||
<%= if @password_changeset.action do %>
|
||||
<div class="alert alert-danger">
|
||||
<p>Oops, something went wrong! Please check the errors below.</p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= hidden_input f, :action, name: "action", value: "update_password" %>
|
||||
|
||||
<div class="grid grid-cols-3 justify-center items-center text-center space-x-4">
|
||||
<%= label f, :password, "New password",
|
||||
class: "title text-lg text-primary-500" %>
|
||||
<%= password_input f, :password,
|
||||
required: true,
|
||||
class: "input input-primary col-span-2" %>
|
||||
</div>
|
||||
<%= error_tag f, :password %>
|
||||
|
||||
<div class="grid grid-cols-3 justify-center items-center text-center space-x-4">
|
||||
<%= label f, :password_confirmation, "Confirm new password",
|
||||
class: "title text-lg text-primary-500" %>
|
||||
<%= password_input f, :password_confirmation,
|
||||
required: true,
|
||||
class: "input input-primary col-span-2" %>
|
||||
</div>
|
||||
<%= error_tag f, :password_confirmation %>
|
||||
|
||||
<div class="grid grid-cols-3 justify-center items-center text-center space-x-4">
|
||||
<%= label f, :current_password,
|
||||
for: "current_password_for_password",
|
||||
class: "title text-lg text-primary-500" %>
|
||||
<%= password_input f, :current_password,
|
||||
required: true,
|
||||
name: "current_password",
|
||||
id: "current_password_for_password",
|
||||
class: "input input-primary col-span-2" %>
|
||||
</div>
|
||||
<%= error_tag f, :current_password %>
|
||||
|
||||
<%= submit "Change password", class: "btn btn-primary" %>
|
||||
<% end %>
|
||||
|
||||
<%= link "Delete User", to: Routes.user_settings_path(@conn, :delete, @current_user),
|
||||
method: :delete, class: "btn btn-alert",
|
||||
data: [confirm: "Are you sure you want to delete your account?"] %>
|
||||
</div>
|
106
lib/cannery_web/templates/user_settings/edit.html.heex
Normal file
106
lib/cannery_web/templates/user_settings/edit.html.heex
Normal file
@ -0,0 +1,106 @@
|
||||
<div class="mb-8 flex flex-col justify-center items-center space-y-8">
|
||||
<h1 class="title text-primary-500 text-xl">
|
||||
<%= gettext("Settings") %>
|
||||
</h1>
|
||||
|
||||
<h3 class="title text-primary-500 text-lg">
|
||||
<%= dgettext("actions", "Change email") %>
|
||||
</h3>
|
||||
|
||||
<%= form_for @email_changeset,
|
||||
Routes.user_settings_path(@conn, :update),
|
||||
[class: "flex flex-col justify-center items-center space-y-4"],
|
||||
fn f -> %>
|
||||
<%= if @email_changeset.action do %>
|
||||
<div class="alert alert-danger">
|
||||
<p>
|
||||
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= hidden_input(f, :action, name: "action", value: "update_email") %>
|
||||
|
||||
<div class="grid grid-cols-3 justify-center items-center text-center space-x-4">
|
||||
<%= label(f, :email, class: "title text-lg text-primary-500") %>
|
||||
<%= email_input(f, :email, required: true, class: "input input-primary col-span-2") %>
|
||||
</div>
|
||||
<%= error_tag(f, :email) %>
|
||||
|
||||
<div class="grid grid-cols-3 justify-center items-center text-center space-x-4">
|
||||
<%= label(f, :current_password,
|
||||
for: "current_password_for_email",
|
||||
class: "title text-lg text-primary-500"
|
||||
) %>
|
||||
<%= password_input(f, :current_password,
|
||||
required: true,
|
||||
name: "current_password",
|
||||
id: "current_password_for_email",
|
||||
class: "input input-primary col-span-2"
|
||||
) %>
|
||||
</div>
|
||||
<%= error_tag(f, :current_password) %>
|
||||
|
||||
<%= submit(dgettext("actions", "Change email"), class: "btn btn-primary") %>
|
||||
<% end %>
|
||||
|
||||
<h3 class="title text-primary-500 text-lg">
|
||||
<%= dgettext("actions", "Change password") %>
|
||||
</h3>
|
||||
|
||||
<%= form_for @password_changeset,
|
||||
Routes.user_settings_path(@conn, :update),
|
||||
[class: "flex flex-col justify-center items-center space-y-4"],
|
||||
fn f -> %>
|
||||
<%= if @password_changeset.action do %>
|
||||
<div class="alert alert-danger">
|
||||
<p>
|
||||
<%= dgettext("errors", "Oops, something went wrong! Please check the errors below.") %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= hidden_input(f, :action, name: "action", value: "update_password") %>
|
||||
|
||||
<div class="grid grid-cols-3 justify-center items-center text-center space-x-4">
|
||||
<%= label(f, :password, "New password", class: "title text-lg text-primary-500") %>
|
||||
<%= password_input(f, :password,
|
||||
required: true,
|
||||
class: "input input-primary col-span-2"
|
||||
) %>
|
||||
</div>
|
||||
<%= error_tag(f, :password) %>
|
||||
|
||||
<div class="grid grid-cols-3 justify-center items-center text-center space-x-4">
|
||||
<%= label(f, :password_confirmation, "Confirm new password", class: "title text-lg text-primary-500") %>
|
||||
<%= password_input(f, :password_confirmation,
|
||||
required: true,
|
||||
class: "input input-primary col-span-2"
|
||||
) %>
|
||||
</div>
|
||||
<%= error_tag(f, :password_confirmation) %>
|
||||
|
||||
<div class="grid grid-cols-3 justify-center items-center text-center space-x-4">
|
||||
<%= label(f, :current_password,
|
||||
for: "current_password_for_password",
|
||||
class: "title text-lg text-primary-500"
|
||||
) %>
|
||||
<%= password_input(f, :current_password,
|
||||
required: true,
|
||||
name: "current_password",
|
||||
id: "current_password_for_password",
|
||||
class: "input input-primary col-span-2"
|
||||
) %>
|
||||
</div>
|
||||
<%= error_tag(f, :current_password) %>
|
||||
|
||||
<%= submit(dgettext("actions", "Change password"), class: "btn btn-primary") %>
|
||||
<% end %>
|
||||
|
||||
<%= link(dgettext("actions", "Delete User"),
|
||||
to: 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?")]
|
||||
) %>
|
||||
</div>
|
Reference in New Issue
Block a user