rename page path to home path

This commit is contained in:
shibao 2022-05-05 21:47:22 -04:00
parent a24bae475f
commit 90e26aa7eb
39 changed files with 238 additions and 234 deletions

View File

@ -27,21 +27,21 @@ defmodule Lokal.Email do
@spec generate_email(key :: String.t(), User.t(), attrs :: map()) :: t() @spec generate_email(key :: String.t(), User.t(), attrs :: map()) :: t()
def generate_email("welcome", user, %{"url" => url}) do def generate_email("welcome", user, %{"url" => url}) do
user user
|> base_email(dgettext("emails", "Confirm your %{name} account", name: "Lokal")) |> base_email(dgettext("emails", "Confirm your Lokal account"))
|> render_body("confirm_email.html", %{user: user, url: url}) |> render_body("confirm_email.html", %{user: user, url: url})
|> text_body(EmailView.render("confirm_email.txt", %{user: user, url: url})) |> text_body(EmailView.render("confirm_email.txt", %{user: user, url: url}))
end end
def generate_email("reset_password", user, %{"url" => url}) do def generate_email("reset_password", user, %{"url" => url}) do
user user
|> base_email(dgettext("emails", "Reset your %{name} password", name: "Lokal")) |> base_email(dgettext("emails", "Reset your Lokal password"))
|> render_body("reset_password.html", %{user: user, url: url}) |> render_body("reset_password.html", %{user: user, url: url})
|> text_body(EmailView.render("reset_password.txt", %{user: user, url: url})) |> text_body(EmailView.render("reset_password.txt", %{user: user, url: url}))
end end
def generate_email("update_email", user, %{"url" => url}) do def generate_email("update_email", user, %{"url" => url}) do
user user
|> base_email(dgettext("emails", "Update your %{name} email", name: "Lokal")) |> base_email(dgettext("emails", "Update your Lokal email"))
|> render_body("update_email.html", %{user: user, url: url}) |> render_body("update_email.html", %{user: user, url: url})
|> text_body(EmailView.render("update_email.txt", %{user: user, url: url})) |> text_body(EmailView.render("update_email.txt", %{user: user, url: url}))
end end

View File

@ -6,7 +6,7 @@ defmodule LokalWeb.Components.Topbar do
use LokalWeb, :component use LokalWeb, :component
alias Lokal.Accounts alias Lokal.Accounts
alias LokalWeb.{Endpoint, PageLive} alias LokalWeb.{Endpoint, HomeLive}
def topbar(assigns) do def topbar(assigns) do
assigns = assigns =
@ -17,7 +17,7 @@ defmodule LokalWeb.Components.Topbar do
<div class="flex flex-col sm:flex-row justify-between items-center"> <div class="flex flex-col sm:flex-row justify-between items-center">
<div class="mb-4 sm:mb-0 sm:mr-8 flex flex-row justify-start items-center space-x-2"> <div class="mb-4 sm:mb-0 sm:mr-8 flex flex-row justify-start items-center space-x-2">
<%= live_redirect("Lokal", <%= live_redirect("Lokal",
to: Routes.live_path(Endpoint, PageLive), to: Routes.live_path(Endpoint, HomeLive),
class: "mx-2 my-1 leading-5 text-xl text-white hover:underline" class: "mx-2 my-1 leading-5 text-xl text-white hover:underline"
) %> ) %>

View File

@ -1,4 +1,8 @@
defmodule LokalWeb.PageController do defmodule LokalWeb.HomeController do
@moduledoc """
Controller for home page
"""
use LokalWeb, :controller use LokalWeb, :controller
def index(conn, _params) do def index(conn, _params) do

View File

@ -7,7 +7,7 @@ defmodule LokalWeb.UserAuth do
import Phoenix.Controller import Phoenix.Controller
import LokalWeb.Gettext import LokalWeb.Gettext
alias Lokal.{Accounts, Accounts.User} alias Lokal.{Accounts, Accounts.User}
alias LokalWeb.PageLive alias LokalWeb.HomeLive
alias LokalWeb.Router.Helpers, as: Routes alias LokalWeb.Router.Helpers, as: Routes
# Make the remember me cookie valid for 60 days. # Make the remember me cookie valid for 60 days.
@ -176,7 +176,7 @@ defmodule LokalWeb.UserAuth do
conn conn
|> put_flash(:error, dgettext("errors", "You are not authorized to view this page.")) |> put_flash(:error, dgettext("errors", "You are not authorized to view this page."))
|> maybe_store_return_to() |> maybe_store_return_to()
|> redirect(to: Routes.live_path(conn, PageLive)) |> redirect(to: Routes.live_path(conn, HomeLive))
|> halt() |> halt()
end end
end end

View File

@ -3,7 +3,7 @@ defmodule LokalWeb.UserRegistrationController do
import LokalWeb.Gettext import LokalWeb.Gettext
alias Lokal.{Accounts, Invites} alias Lokal.{Accounts, Invites}
alias Lokal.Accounts.User alias Lokal.Accounts.User
alias LokalWeb.{Endpoint, PageLive} alias LokalWeb.{Endpoint, HomeLive}
def new(conn, %{"invite" => invite_token}) do def new(conn, %{"invite" => invite_token}) do
invite = Invites.get_invite_by_token(invite_token) invite = Invites.get_invite_by_token(invite_token)
@ -13,7 +13,7 @@ defmodule LokalWeb.UserRegistrationController do
else else
conn conn
|> put_flash(:error, dgettext("errors", "Sorry, this invite was not found or expired")) |> put_flash(:error, dgettext("errors", "Sorry, this invite was not found or expired"))
|> redirect(to: Routes.live_path(Endpoint, PageLive)) |> redirect(to: Routes.live_path(Endpoint, HomeLive))
end end
end end
@ -23,7 +23,7 @@ defmodule LokalWeb.UserRegistrationController do
else else
conn conn
|> put_flash(:error, dgettext("errors", "Sorry, public registration is disabled")) |> put_flash(:error, dgettext("errors", "Sorry, public registration is disabled"))
|> redirect(to: Routes.live_path(Endpoint, PageLive)) |> redirect(to: Routes.live_path(Endpoint, HomeLive))
end end
end end
@ -44,7 +44,7 @@ defmodule LokalWeb.UserRegistrationController do
else else
conn conn
|> put_flash(:error, dgettext("errors", "Sorry, this invite was not found or expired")) |> put_flash(:error, dgettext("errors", "Sorry, this invite was not found or expired"))
|> redirect(to: Routes.live_path(Endpoint, PageLive)) |> redirect(to: Routes.live_path(Endpoint, HomeLive))
end end
end end
@ -54,7 +54,7 @@ defmodule LokalWeb.UserRegistrationController do
else else
conn conn
|> put_flash(:error, dgettext("errors", "Sorry, public registration is disabled")) |> put_flash(:error, dgettext("errors", "Sorry, public registration is disabled"))
|> redirect(to: Routes.live_path(Endpoint, PageLive)) |> redirect(to: Routes.live_path(Endpoint, HomeLive))
end end
end end

View File

@ -2,7 +2,7 @@ defmodule LokalWeb.UserSettingsController do
use LokalWeb, :controller use LokalWeb, :controller
import LokalWeb.Gettext import LokalWeb.Gettext
alias Lokal.Accounts alias Lokal.Accounts
alias LokalWeb.{PageLive, UserAuth} alias LokalWeb.{HomeLive, UserAuth}
plug :assign_email_and_password_changesets plug :assign_email_and_password_changesets
@ -93,7 +93,7 @@ defmodule LokalWeb.UserSettingsController do
conn conn
|> put_flash(:error, dgettext("prompts", "Your account has been deleted")) |> put_flash(:error, dgettext("prompts", "Your account has been deleted"))
|> redirect(to: Routes.live_path(conn, PageLive)) |> redirect(to: Routes.live_path(conn, HomeLive))
else else
conn conn
|> put_flash(:error, dgettext("errors", "Unable to delete user")) |> put_flash(:error, dgettext("errors", "Unable to delete user"))

View File

@ -1,4 +1,4 @@
defmodule LokalWeb.PageLive do defmodule LokalWeb.HomeLive do
@moduledoc """ @moduledoc """
Liveview for the main home page Liveview for the main home page
""" """

View File

@ -38,7 +38,9 @@ defmodule LokalWeb.InviteLive.FormComponent do
socket = socket =
case invite |> Invites.update_invite(invite_params, current_user) do case invite |> Invites.update_invite(invite_params, current_user) do
{:ok, %{name: invite_name}} -> {:ok, %{name: invite_name}} ->
prompt = dgettext("prompts", "%{name} updated successfully", name: invite_name) prompt =
dgettext("prompts", "%{invite_name} updated successfully", invite_name: invite_name)
socket |> put_flash(:info, prompt) |> push_redirect(to: return_to) socket |> put_flash(:info, prompt) |> push_redirect(to: return_to)
{:error, %Changeset{} = changeset} -> {:error, %Changeset{} = changeset} ->
@ -56,7 +58,9 @@ defmodule LokalWeb.InviteLive.FormComponent do
socket = socket =
case current_user |> Invites.create_invite(invite_params) do case current_user |> Invites.create_invite(invite_params) do
{:ok, %{name: invite_name}} -> {:ok, %{name: invite_name}} ->
prompt = dgettext("prompts", "%{name} created successfully", name: invite_name) prompt =
dgettext("prompts", "%{invite_name} created successfully", invite_name: invite_name)
socket |> put_flash(:info, prompt) |> push_redirect(to: return_to) socket |> put_flash(:info, prompt) |> push_redirect(to: return_to)
{:error, %Changeset{} = changeset} -> {:error, %Changeset{} = changeset} ->

View File

@ -6,7 +6,7 @@ defmodule LokalWeb.InviteLive.Index do
use LokalWeb, :live_view use LokalWeb, :live_view
import LokalWeb.Components.{InviteCard, UserCard} import LokalWeb.Components.{InviteCard, UserCard}
alias Lokal.{Accounts, Invites, Invites.Invite} alias Lokal.{Accounts, Invites, Invites.Invite}
alias LokalWeb.{Endpoint, PageLive} alias LokalWeb.{Endpoint, HomeLive}
alias Phoenix.LiveView.JS alias Phoenix.LiveView.JS
@impl true @impl true
@ -16,7 +16,7 @@ defmodule LokalWeb.InviteLive.Index do
socket |> display_invites() socket |> display_invites()
else else
prompt = dgettext("errors", "You are not authorized to view this page") prompt = dgettext("errors", "You are not authorized to view this page")
return_to = Routes.live_path(Endpoint, PageLive) return_to = Routes.live_path(Endpoint, HomeLive)
socket |> put_flash(:error, prompt) |> push_redirect(to: return_to) socket |> put_flash(:error, prompt) |> push_redirect(to: return_to)
end end
@ -50,7 +50,7 @@ defmodule LokalWeb.InviteLive.Index do
%{name: invite_name} = %{name: invite_name} =
id |> Invites.get_invite!(current_user) |> Invites.delete_invite!(current_user) id |> Invites.get_invite!(current_user) |> Invites.delete_invite!(current_user)
prompt = dgettext("prompts", "%{name} deleted succesfully", name: invite_name) prompt = dgettext("prompts", "%{invite_name} deleted succesfully", invite_name: invite_name)
{:noreply, socket |> put_flash(:info, prompt) |> display_invites()} {:noreply, socket |> put_flash(:info, prompt) |> display_invites()}
end end
@ -64,7 +64,9 @@ defmodule LokalWeb.InviteLive.Index do
|> Invites.update_invite(%{"uses_left" => nil}, current_user) |> Invites.update_invite(%{"uses_left" => nil}, current_user)
|> case do |> case do
{:ok, %{name: invite_name}} -> {:ok, %{name: invite_name}} ->
prompt = dgettext("prompts", "%{name} updated succesfully", name: invite_name) prompt =
dgettext("prompts", "%{invite_name} updated succesfully", invite_name: invite_name)
socket |> put_flash(:info, prompt) |> display_invites() socket |> put_flash(:info, prompt) |> display_invites()
{:error, changeset} -> {:error, changeset} ->
@ -84,7 +86,9 @@ defmodule LokalWeb.InviteLive.Index do
|> Invites.update_invite(%{"uses_left" => nil, "disabled_at" => nil}, current_user) |> Invites.update_invite(%{"uses_left" => nil, "disabled_at" => nil}, current_user)
|> case do |> case do
{:ok, %{name: invite_name}} -> {:ok, %{name: invite_name}} ->
prompt = dgettext("prompts", "%{name} enabled succesfully", name: invite_name) prompt =
dgettext("prompts", "%{invite_name} enabled succesfully", invite_name: invite_name)
socket |> put_flash(:info, prompt) |> display_invites() socket |> put_flash(:info, prompt) |> display_invites()
{:error, changeset} -> {:error, changeset} ->
@ -106,7 +110,9 @@ defmodule LokalWeb.InviteLive.Index do
|> Invites.update_invite(%{"uses_left" => 0, "disabled_at" => now}, current_user) |> Invites.update_invite(%{"uses_left" => 0, "disabled_at" => now}, current_user)
|> case do |> case do
{:ok, %{name: invite_name}} -> {:ok, %{name: invite_name}} ->
prompt = dgettext("prompts", "%{name} disabled succesfully", name: invite_name) prompt =
dgettext("prompts", "%{invite_name} disabled succesfully", invite_name: invite_name)
socket |> put_flash(:info, prompt) |> display_invites() socket |> put_flash(:info, prompt) |> display_invites()
{:error, changeset} -> {:error, changeset} ->
@ -130,7 +136,7 @@ defmodule LokalWeb.InviteLive.Index do
) do ) do
%{email: user_email} = Accounts.get_user!(id) |> Accounts.delete_user!(current_user) %{email: user_email} = Accounts.get_user!(id) |> Accounts.delete_user!(current_user)
prompt = dgettext("prompts", "%{name} deleted succesfully", name: user_email) prompt = dgettext("prompts", "%{user_email} deleted succesfully", user_email: user_email)
{:noreply, socket |> put_flash(:info, prompt) |> display_invites()} {:noreply, socket |> put_flash(:info, prompt) |> display_invites()}
end end

View File

@ -45,8 +45,8 @@
phx_value_id: invite.id, phx_value_id: invite.id,
data: [ data: [
confirm: confirm:
dgettext("prompts", "Are you sure you want to delete the invite for %{name}?", dgettext("prompts", "Are you sure you want to delete the invite for %{invite_name}?",
name: invite.name invite_name: invite.name
), ),
qa: "delete-#{invite.id}" qa: "delete-#{invite.id}"
] do %> ] do %>
@ -70,8 +70,8 @@
phx-click="set_unlimited" phx-click="set_unlimited"
phx-value-id={invite.id} phx-value-id={invite.id}
data-confirm={ data-confirm={
dgettext("prompts", "Are you sure you want to make %{name} unlimited?", dgettext("prompts", "Are you sure you want to make %{invite_name} unlimited?",
name: invite.name invite_name: invite.name
) )
} }
> >

View File

@ -35,7 +35,7 @@ defmodule LokalWeb.Router do
scope "/", LokalWeb do scope "/", LokalWeb do
pipe_through :browser pipe_through :browser
live "/", PageLive live "/", HomeLive
end end
## Authentication routes ## Authentication routes

View File

@ -3,23 +3,21 @@
<%= dgettext("emails", "Hi %{email},", email: @user.email) %> <%= dgettext("emails", "Hi %{email},", email: @user.email) %>
</span> </span>
<br/> <br />
<span style="margin-bottom: 1em; font-size: 1.25em;"> <span style="margin-bottom: 1em; font-size: 1.25em;">
<%= dgettext("emails", "Welcome to %{name}!", name: "Lokal") %> <%= dgettext("emails", "Welcome to Lokal") %>
</span> </span>
<br/> <br />
<%= dgettext("emails", "You can confirm your account by visiting the URL below:") %> <%= dgettext("emails", "You can confirm your account by visiting the URL below:") %>
<br/> <br />
<a style="margin: 1em; color: rgb(31, 31, 31);" href="<%= @url %>"><%= @url %></a> <a style="margin: 1em; color: rgb(31, 31, 31);" href={@url}><%= @url %></a>
<br/> <br />
<%= dgettext("emails", <%= dgettext("emails", "If you didn't create an account at Lokal, please ignore this.") %>
"If you didn't create an account at %{name}, please ignore this.",
name: "Lokal") %>
</div> </div>

View File

@ -1,7 +1,7 @@
<%= dgettext("emails", "Hi %{email},", email: @user.email) %> <%= dgettext("emails", "Hi %{email},", email: @user.email) %>
<%= dgettext("emails", "Welcome to %{name}%!", name: "Lokal") %> <%= dgettext("emails", "Welcome to Lokal") %>
<%= dgettext("emails", "You can confirm your account by visiting the URL below:") %> <%= dgettext("emails", "You can confirm your account by visiting the URL below:") %>
@ -9,4 +9,4 @@
<%= dgettext("emails", <%= dgettext("emails",
"If you didn't create an account at %{url}, please ignore this.", "If you didn't create an account at %{url}, please ignore this.",
url: Routes.live_url(Endpoint, PageLive)) %> url: Routes.live_url(Endpoint, HomeLive)) %>

View File

@ -3,17 +3,15 @@
<%= dgettext("emails", "Hi %{email},", email: @user.email) %> <%= dgettext("emails", "Hi %{email},", email: @user.email) %>
</span> </span>
<br/> <br />
<%= dgettext("emails", "You can reset your password by visiting the URL below:") %> <%= dgettext("emails", "You can reset your password by visiting the URL below:") %>
<br/> <br />
<a style="margin: 1em; color: rgb(31, 31, 31);" href="<%= @url %>"><%= @url %></a> <a style="margin: 1em; color: rgb(31, 31, 31);" href={@url}><%= @url %></a>
<br/> <br />
<%= dgettext("emails", <%= dgettext("emails", "If you didn't request this change from Lokal, please ignore this.") %>
"If you didn't request this change from %{name}, please ignore this.",
name: "Lokal") %>
</div> </div>

View File

@ -7,4 +7,4 @@
<%= dgettext("emails", <%= dgettext("emails",
"If you didn't request this change from %{url}, please ignore this.", "If you didn't request this change from %{url}, please ignore this.",
url: Routes.live_url(Endpoint, PageLive)) %> url: Routes.live_url(Endpoint, HomeLive)) %>

View File

@ -3,17 +3,18 @@
<%= dgettext("emails", "Hi %{email},", email: @user.email) %> <%= dgettext("emails", "Hi %{email},", email: @user.email) %>
</span> </span>
<br/> <br />
<%= dgettext("emails", "You can change your email by visiting the URL below:") %> <%= dgettext("emails", "You can change your email by visiting the URL below:") %>
<br/> <br />
<a style="margin: 1em; color: rgb(31, 31, 31);" href="<%= @url %>"><%= @url %></a> <a style="margin: 1em; color: rgb(31, 31, 31);" href={@url}><%= @url %></a>
<br/> <br />
<%= dgettext("emails", <%= dgettext(
"If you didn't request this change from %{name}, please ignore this.", "emails",
name: "Lokal") %> "If you didn't request this change from Lokal, please ignore this."
) %>
</div> </div>

View File

@ -7,4 +7,4 @@
<%= dgettext("emails", <%= dgettext("emails",
"If you didn't request this change from %{url}, please ignore this.", "If you didn't request this change from %{url}, please ignore this.",
url: Routes.live_url(Endpoint, PageLive)) %> url: Routes.live_url(Endpoint, HomeLive)) %>

View File

@ -24,7 +24,7 @@
<hr class="w-full hr" /> <hr class="w-full hr" />
<a href={Routes.live_path(Endpoint, PageLive)} class="link title text-primary-600 text-lg"> <a href={Routes.live_path(Endpoint, HomeLive)} class="link title text-primary-600 text-lg">
<%= dgettext("errors", "Go back home") %> <%= dgettext("errors", "Go back home") %>
</a> </a>
</div> </div>

View File

@ -9,11 +9,10 @@
<hr style="margin: 2em auto; border-width: 1px; border-color: rgb(212, 212, 216); width: 100%; max-width: 42rem;" /> <hr style="margin: 2em auto; border-width: 1px; border-color: rgb(212, 212, 216); width: 100%; max-width: 42rem;" />
<a style="color: rgb(31, 31, 31);" href={Routes.live_url(Endpoint, PageLive)}> <a style="color: rgb(31, 31, 31);" href={Routes.live_url(Endpoint, HomeLive)}>
<%= dgettext( <%= dgettext(
"emails", "emails",
"This email was sent from %{name}, the self-hosted firearm tracker website.", "This email was sent from Lokal, the self-hosted firearm tracker website."
name: "Lokal"
) %> ) %>
</a> </a>
</body> </body>

View File

@ -7,6 +7,5 @@
===================== =====================
<%= dgettext("emails", <%= dgettext("emails",
"This email was sent from %{name} at %{url}, the self-hosted firearm tracker website.", "This email was sent from Lokal at %{url}, the self-hosted firearm tracker website.",
name: "Lokal", url: Routes.live_url(Endpoint, HomeLive)) %>
url: Routes.live_url(Endpoint, PageLive)) %>

View File

@ -3,20 +3,19 @@
<%= dgettext("actions", "Resend confirmation instructions") %> <%= dgettext("actions", "Resend confirmation instructions") %>
</h1> </h1>
<%= form_for :user, <.form
Routes.user_confirmation_path(@conn, :create), let={f}
[ for={:user}
class: action={Routes.user_confirmation_path(@conn, :create)}
"flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center" class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
], >
fn f -> %>
<%= label(f, :email, class: "title text-lg text-primary-600") %> <%= label(f, :email, class: "title text-lg text-primary-600") %>
<%= email_input(f, :email, required: true, class: "input input-primary col-span-2") %> <%= email_input(f, :email, required: true, class: "input input-primary col-span-2") %>
<%= submit(dgettext("actions", "Resend confirmation instructions"), <%= submit(dgettext("actions", "Resend confirmation instructions"),
class: "mx-auto btn btn-primary col-span-3" class: "mx-auto btn btn-primary col-span-3"
) %> ) %>
<% end %> </.form>
<hr class="hr" /> <hr class="hr" />

View File

@ -3,13 +3,12 @@
<%= dgettext("actions", "Register") %> <%= dgettext("actions", "Register") %>
</h1> </h1>
<%= form_for @changeset, <.form
Routes.user_registration_path(@conn, :create), let={f}
[ for={@changeset}
class: action={Routes.user_registration_path(@conn, :create)}
"flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center" class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
], >
fn f -> %>
<%= if @changeset.action && not @changeset.valid? do %> <%= if @changeset.action && not @changeset.valid? do %>
<div class="alert alert-danger col-span-3"> <div class="alert alert-danger col-span-3">
<p> <p>
@ -40,7 +39,7 @@
<%= error_tag(f, :locale) %> <%= error_tag(f, :locale) %>
<%= submit(dgettext("actions", "Register"), class: "mx-auto btn btn-primary col-span-3") %> <%= submit(dgettext("actions", "Register"), class: "mx-auto btn btn-primary col-span-3") %>
<% end %> </.form>
<hr class="hr" /> <hr class="hr" />

View File

@ -3,13 +3,12 @@
<%= dgettext("actions", "Reset password") %> <%= dgettext("actions", "Reset password") %>
</h1> </h1>
<%= form_for @changeset, <.form
Routes.user_reset_password_path(@conn, :update, @token), let={f}
[ for={@changeset}
class: action={Routes.user_reset_password_path(@conn, :update, @token)}
"flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center" class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
], >
fn f -> %>
<%= if @changeset.action && not @changeset.valid? do %> <%= if @changeset.action && not @changeset.valid? do %>
<div class="alert alert-danger col-span-3"> <div class="alert alert-danger col-span-3">
<p> <p>
@ -34,7 +33,7 @@
<%= submit(dgettext("actions", "Reset password"), <%= submit(dgettext("actions", "Reset password"),
class: "mx-auto btn btn-primary col-span-3" class: "mx-auto btn btn-primary col-span-3"
) %> ) %>
<% end %> </.form>
<hr class="hr" /> <hr class="hr" />

View File

@ -3,20 +3,19 @@
<%= dgettext("actions", "Forgot your password?") %> <%= dgettext("actions", "Forgot your password?") %>
</h1> </h1>
<%= form_for :user, <.form
Routes.user_reset_password_path(@conn, :create), let={f}
[ for={:user}
class: action={Routes.user_reset_password_path(@conn, :create)}
"flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center" class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
], >
fn f -> %>
<%= label(f, :email, class: "title text-lg text-primary-600") %> <%= label(f, :email, class: "title text-lg text-primary-600") %>
<%= email_input(f, :email, required: true, class: "input input-primary col-span-2") %> <%= email_input(f, :email, required: true, class: "input input-primary col-span-2") %>
<%= submit(dgettext("actions", "Send instructions to reset password"), <%= submit(dgettext("actions", "Send instructions to reset password"),
class: "mx-auto btn btn-primary col-span-3" class: "mx-auto btn btn-primary col-span-3"
) %> ) %>
<% end %> </.form>
<hr class="hr" /> <hr class="hr" />

View File

@ -3,14 +3,13 @@
<%= dgettext("actions", "Log in") %> <%= dgettext("actions", "Log in") %>
</h1> </h1>
<%= form_for @conn, <.form
Routes.user_session_path(@conn, :create), let={f}
[ for={@conn}
as: :user, action={Routes.user_session_path(@conn, :create)}
class: as="user"
"flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center" class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
], >
fn f -> %>
<%= if @error_message do %> <%= if @error_message do %>
<div class="alert alert-danger col-span-3"> <div class="alert alert-danger col-span-3">
<p> <p>
@ -31,7 +30,7 @@
<%= checkbox(f, :remember_me, class: "checkbox col-span-2") %> <%= checkbox(f, :remember_me, class: "checkbox col-span-2") %>
<%= submit(dgettext("actions", "Log in"), class: "mx-auto btn btn-primary col-span-3") %> <%= submit(dgettext("actions", "Log in"), class: "mx-auto btn btn-primary col-span-3") %>
<% end %> </.form>
<hr class="hr" /> <hr class="hr" />

View File

@ -2,7 +2,7 @@ defmodule LokalWeb.EmailView do
@moduledoc """ @moduledoc """
A view for email-related helper functions A view for email-related helper functions
""" """
alias LokalWeb.{Endpoint, PageLive} alias LokalWeb.{Endpoint, HomeLive}
use LokalWeb, :view use LokalWeb, :view
end end

View File

@ -1,7 +1,7 @@
defmodule LokalWeb.ErrorView do defmodule LokalWeb.ErrorView do
use LokalWeb, :view use LokalWeb, :view
import LokalWeb.Components.Topbar import LokalWeb.Components.Topbar
alias LokalWeb.{Endpoint, PageLive} alias LokalWeb.{Endpoint, HomeLive}
def template_not_found(error_path, _assigns) do def template_not_found(error_path, _assigns) do
error_string = error_string =

View File

@ -1,7 +1,7 @@
defmodule LokalWeb.LayoutView do defmodule LokalWeb.LayoutView do
use LokalWeb, :view use LokalWeb, :view
import LokalWeb.Components.Topbar import LokalWeb.Components.Topbar
alias LokalWeb.{Endpoint, PageLive} alias LokalWeb.{Endpoint, HomeLive}
# Phoenix LiveDashboard is available only in development by default, # Phoenix LiveDashboard is available only in development by default,
# so we instruct Elixir to not warn if the dashboard route is missing. # so we instruct Elixir to not warn if the dashboard route is missing.

View File

@ -28,48 +28,48 @@ msgid "Delete User"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal_web/templates/user_registration/new.html.heex:43 #: lib/lokal_web/templates/user_registration/new.html.heex:42
#: lib/lokal_web/templates/user_reset_password/new.html.heex:3 #: lib/lokal_web/templates/user_reset_password/new.html.heex:3
#: lib/lokal_web/templates/user_session/new.html.heex:45 #: lib/lokal_web/templates/user_session/new.html.heex:44
msgid "Forgot your password?" msgid "Forgot your password?"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal_web/components/topbar.ex:93 #: lib/lokal_web/components/topbar.ex:93
#: lib/lokal_web/templates/user_confirmation/new.html.heex:30 #: lib/lokal_web/templates/user_confirmation/new.html.heex:29
#: lib/lokal_web/templates/user_registration/new.html.heex:39 #: lib/lokal_web/templates/user_registration/new.html.heex:38
#: lib/lokal_web/templates/user_reset_password/edit.html.heex:48 #: lib/lokal_web/templates/user_reset_password/edit.html.heex:47
#: lib/lokal_web/templates/user_reset_password/new.html.heex:30 #: lib/lokal_web/templates/user_reset_password/new.html.heex:29
#: lib/lokal_web/templates/user_session/new.html.heex:3 #: lib/lokal_web/templates/user_session/new.html.heex:3
#: lib/lokal_web/templates/user_session/new.html.heex:33 #: lib/lokal_web/templates/user_session/new.html.heex:32
msgid "Log in" msgid "Log in"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal_web/components/topbar.ex:86 #: lib/lokal_web/components/topbar.ex:86
#: lib/lokal_web/templates/user_confirmation/new.html.heex:25 #: lib/lokal_web/templates/user_confirmation/new.html.heex:24
#: lib/lokal_web/templates/user_registration/new.html.heex:3 #: lib/lokal_web/templates/user_registration/new.html.heex:3
#: lib/lokal_web/templates/user_registration/new.html.heex:33 #: lib/lokal_web/templates/user_registration/new.html.heex:32
#: lib/lokal_web/templates/user_reset_password/edit.html.heex:43 #: lib/lokal_web/templates/user_reset_password/edit.html.heex:42
#: lib/lokal_web/templates/user_reset_password/new.html.heex:25 #: lib/lokal_web/templates/user_reset_password/new.html.heex:24
#: lib/lokal_web/templates/user_session/new.html.heex:40 #: lib/lokal_web/templates/user_session/new.html.heex:39
msgid "Register" msgid "Register"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal_web/templates/user_confirmation/new.html.heex:3 #: lib/lokal_web/templates/user_confirmation/new.html.heex:3
#: lib/lokal_web/templates/user_confirmation/new.html.heex:16 #: lib/lokal_web/templates/user_confirmation/new.html.heex:15
msgid "Resend confirmation instructions" msgid "Resend confirmation instructions"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal_web/templates/user_reset_password/edit.html.heex:3 #: lib/lokal_web/templates/user_reset_password/edit.html.heex:3
#: lib/lokal_web/templates/user_reset_password/edit.html.heex:34 #: lib/lokal_web/templates/user_reset_password/edit.html.heex:33
msgid "Reset password" msgid "Reset password"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal_web/templates/user_reset_password/new.html.heex:16 #: lib/lokal_web/templates/user_reset_password/new.html.heex:15
msgid "Send instructions to reset password" msgid "Send instructions to reset password"
msgstr "" msgstr ""

View File

@ -44,7 +44,7 @@ msgid "Invites"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal_web/templates/user_session/new.html.heex:28 #: lib/lokal_web/templates/user_session/new.html.heex:27
msgid "Keep me logged in for 60 days" msgid "Keep me logged in for 60 days"
msgstr "" msgstr ""
@ -85,7 +85,7 @@ msgid "Settings"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal_web/live/page_live.html.leex:7 #: lib/lokal_web/live/home_live.html.heex:7
msgid "Shop from your community" msgid "Shop from your community"
msgstr "" msgstr ""
@ -95,12 +95,12 @@ msgid "Uses Left:"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal_web/live/page_live.html.leex:3 #: lib/lokal_web/live/home_live.html.heex:3
msgid "Welcome to Lokal" msgid "Welcome to Lokal"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal_web/live/page_live.ex:13 #: lib/lokal_web/live/home_live.ex:13
msgid "Home" msgid "Home"
msgstr "" msgstr ""
@ -158,3 +158,8 @@ msgstr ""
#: lib/lokal_web/templates/user_settings/edit.html.heex:126 #: lib/lokal_web/templates/user_settings/edit.html.heex:126
msgid "English" msgid "English"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/components/user_card.ex:30
msgid "User registered on"
msgstr ""

View File

@ -11,36 +11,20 @@ msgid ""
msgstr "" msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal/accounts/email.ex:30 #: lib/lokal_web/templates/email/confirm_email.html.heex:3
msgid "Confirm your %{name} account"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/templates/email/confirm_email.html.eex:3
#: lib/lokal_web/templates/email/confirm_email.txt.eex:2 #: lib/lokal_web/templates/email/confirm_email.txt.eex:2
#: lib/lokal_web/templates/email/reset_password.html.eex:3 #: lib/lokal_web/templates/email/reset_password.html.heex:3
#: lib/lokal_web/templates/email/reset_password.txt.eex:2 #: lib/lokal_web/templates/email/reset_password.txt.eex:2
#: lib/lokal_web/templates/email/update_email.html.eex:3 #: lib/lokal_web/templates/email/update_email.html.heex:3
#: lib/lokal_web/templates/email/update_email.txt.eex:2 #: lib/lokal_web/templates/email/update_email.txt.eex:2
msgid "Hi %{email}," msgid "Hi %{email},"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/templates/email/confirm_email.html.eex:22
msgid "If you didn't create an account at %{name}, please ignore this."
msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal_web/templates/email/confirm_email.txt.eex:10 #: lib/lokal_web/templates/email/confirm_email.txt.eex:10
msgid "If you didn't create an account at %{url}, please ignore this." msgid "If you didn't create an account at %{url}, please ignore this."
msgstr "" msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/templates/email/reset_password.html.eex:16
#: lib/lokal_web/templates/email/update_email.html.eex:16
msgid "If you didn't request this change from %{name}, please ignore this."
msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal_web/templates/email/reset_password.txt.eex:8 #: lib/lokal_web/templates/email/reset_password.txt.eex:8
#: lib/lokal_web/templates/email/update_email.txt.eex:8 #: lib/lokal_web/templates/email/update_email.txt.eex:8
@ -48,49 +32,61 @@ msgid "If you didn't request this change from %{url}, please ignore this."
msgstr "" msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal/accounts/email.ex:37 #: lib/lokal_web/templates/email/update_email.html.heex:8
msgid "Reset your %{name} password"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/templates/layout/email.txt.eex:9
msgid "This email was sent from %{name} at %{url}, the self-hosted firearm tracker website."
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/templates/layout/email.html.heex:13
msgid "This email was sent from %{name}, the self-hosted firearm tracker website."
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal/accounts/email.ex:44
msgid "Update your %{name} email"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/templates/email/confirm_email.html.eex:9
msgid "Welcome to %{name}!"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/templates/email/confirm_email.txt.eex:4
msgid "Welcome to %{name}%!"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/templates/email/update_email.html.eex:8
#: lib/lokal_web/templates/email/update_email.txt.eex:4 #: lib/lokal_web/templates/email/update_email.txt.eex:4
msgid "You can change your email by visiting the URL below:" msgid "You can change your email by visiting the URL below:"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal_web/templates/email/confirm_email.html.eex:14 #: lib/lokal_web/templates/email/confirm_email.html.heex:14
#: lib/lokal_web/templates/email/confirm_email.txt.eex:6 #: lib/lokal_web/templates/email/confirm_email.txt.eex:6
msgid "You can confirm your account by visiting the URL below:" msgid "You can confirm your account by visiting the URL below:"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal_web/templates/email/reset_password.html.eex:8 #: lib/lokal_web/templates/email/reset_password.html.heex:8
#: lib/lokal_web/templates/email/reset_password.txt.eex:4 #: lib/lokal_web/templates/email/reset_password.txt.eex:4
msgid "You can reset your password by visiting the URL below:" msgid "You can reset your password by visiting the URL below:"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal/accounts/email.ex:30
msgid "Confirm your Lokal account"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/templates/email/confirm_email.html.heex:22
msgid "If you didn't create an account at Lokal, please ignore this."
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/templates/email/reset_password.html.heex:16
#: lib/lokal_web/templates/email/update_email.html.heex:16
msgid "If you didn't request this change from Lokal, please ignore this."
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal/accounts/email.ex:37
msgid "Reset your Lokal password"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/templates/layout/email.txt.eex:9
msgid "This email was sent from Lokal at %{url}, the self-hosted firearm tracker website."
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/templates/layout/email.html.heex:13
msgid "This email was sent from Lokal, the self-hosted firearm tracker website."
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal/accounts/email.ex:44
msgid "Update your Lokal email"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/templates/email/confirm_email.html.heex:9
#: lib/lokal_web/templates/email/confirm_email.txt.eex:4
msgid "Welcome to Lokal"
msgstr ""

View File

@ -124,8 +124,8 @@ msgid "Not found"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal_web/templates/user_registration/new.html.heex:16 #: lib/lokal_web/templates/user_registration/new.html.heex:15
#: lib/lokal_web/templates/user_reset_password/edit.html.heex:16 #: lib/lokal_web/templates/user_reset_password/edit.html.heex:15
#: lib/lokal_web/templates/user_settings/edit.html.heex:21 #: lib/lokal_web/templates/user_settings/edit.html.heex:21
#: lib/lokal_web/templates/user_settings/edit.html.heex:64 #: lib/lokal_web/templates/user_settings/edit.html.heex:64
#: lib/lokal_web/templates/user_settings/edit.html.heex:119 #: lib/lokal_web/templates/user_settings/edit.html.heex:119

View File

@ -70,37 +70,6 @@ msgstr ""
msgid "Your account has been deleted" msgid "Your account has been deleted"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/form_component.ex:59
msgid "%{name} created successfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:55
#: lib/lokal_web/live/invite_live/index.ex:135
msgid "%{name} deleted succesfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:111
msgid "%{name} disabled succesfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:89
msgid "%{name} enabled succesfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:69
msgid "%{name} updated succesfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/form_component.ex:41
msgid "%{name} updated successfully"
msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.html.heex:101 #: lib/lokal_web/live/invite_live/index.html.heex:101
#: lib/lokal_web/live/invite_live/index.html.heex:130 #: lib/lokal_web/live/invite_live/index.html.heex:130
@ -108,17 +77,7 @@ msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr "" msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.html.heex:48 #: lib/lokal_web/live/invite_live/index.ex:129
msgid "Are you sure you want to delete the invite for %{name}?"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.html.heex:73
msgid "Are you sure you want to make %{name} unlimited?"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:123
msgid "Copied to clipboard" msgid "Copied to clipboard"
msgstr "" msgstr ""
@ -136,3 +95,48 @@ msgstr ""
#: lib/lokal_web/controllers/user_settings_controller.ex:65 #: lib/lokal_web/controllers/user_settings_controller.ex:65
msgid "Language updated successfully." msgid "Language updated successfully."
msgstr "" msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/form_component.ex:62
msgid "%{invite_name} created successfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:55
msgid "%{invite_name} deleted succesfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:116
msgid "%{invite_name} disabled succesfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:92
msgid "%{invite_name} enabled succesfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:70
msgid "%{invite_name} updated succesfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/form_component.ex:42
msgid "%{invite_name} updated successfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.ex:141
msgid "%{user_email} deleted succesfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.html.heex:48
msgid "Are you sure you want to delete the invite for %{invite_name}?"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/lokal_web/live/invite_live/index.html.heex:73
msgid "Are you sure you want to make %{invite_name} unlimited?"
msgstr ""

View File

@ -1,8 +0,0 @@
defmodule LokalWeb.PageControllerTest do
use LokalWeb.ConnCase
test "GET /", %{conn: conn} do
conn = get(conn, "/")
assert html_response(conn, 200) =~ "Welcome to Lokal"
end
end

View File

@ -46,7 +46,8 @@ defmodule LokalWeb.InviteLiveTest do
|> render_submit() |> render_submit()
|> follow_redirect(conn, Routes.invite_index_path(conn, :index)) |> follow_redirect(conn, Routes.invite_index_path(conn, :index))
assert html =~ dgettext("prompts", "%{name} created successfully", name: "some name") assert html =~
dgettext("prompts", "%{invite_name} created successfully", invite_name: "some name")
assert html =~ "some name" assert html =~ "some name"
end end
@ -70,7 +71,9 @@ defmodule LokalWeb.InviteLiveTest do
|> follow_redirect(conn, Routes.invite_index_path(conn, :index)) |> follow_redirect(conn, Routes.invite_index_path(conn, :index))
assert html =~ assert html =~
dgettext("prompts", "%{name} updated successfully", name: "some updated name") dgettext("prompts", "%{invite_name} updated successfully",
invite_name: "some updated name"
)
assert html =~ "some updated name" assert html =~ "some updated name"
end end

View File

@ -1,4 +1,4 @@
defmodule LokalWeb.PageLiveTest do defmodule LokalWeb.HomeLiveTest do
use LokalWeb.ConnCase use LokalWeb.ConnCase
import Phoenix.LiveViewTest import Phoenix.LiveViewTest