<%= 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"
) %>
diff --git a/lib/lokal_web/controllers/page_controller.ex b/lib/lokal_web/controllers/home_controller.ex
similarity index 53%
rename from lib/lokal_web/controllers/page_controller.ex
rename to lib/lokal_web/controllers/home_controller.ex
index b4b5d60..3f3b44b 100644
--- a/lib/lokal_web/controllers/page_controller.ex
+++ b/lib/lokal_web/controllers/home_controller.ex
@@ -1,4 +1,8 @@
-defmodule LokalWeb.PageController do
+defmodule LokalWeb.HomeController do
+ @moduledoc """
+ Controller for home page
+ """
+
use LokalWeb, :controller
def index(conn, _params) do
diff --git a/lib/lokal_web/controllers/user_auth.ex b/lib/lokal_web/controllers/user_auth.ex
index d9e918d..6620f5f 100644
--- a/lib/lokal_web/controllers/user_auth.ex
+++ b/lib/lokal_web/controllers/user_auth.ex
@@ -7,7 +7,7 @@ defmodule LokalWeb.UserAuth do
import Phoenix.Controller
import LokalWeb.Gettext
alias Lokal.{Accounts, Accounts.User}
- alias LokalWeb.PageLive
+ alias LokalWeb.HomeLive
alias LokalWeb.Router.Helpers, as: Routes
# Make the remember me cookie valid for 60 days.
@@ -176,7 +176,7 @@ defmodule LokalWeb.UserAuth do
conn
|> put_flash(:error, dgettext("errors", "You are not authorized to view this page."))
|> maybe_store_return_to()
- |> redirect(to: Routes.live_path(conn, PageLive))
+ |> redirect(to: Routes.live_path(conn, HomeLive))
|> halt()
end
end
diff --git a/lib/lokal_web/controllers/user_registration_controller.ex b/lib/lokal_web/controllers/user_registration_controller.ex
index 584516e..7d8db16 100644
--- a/lib/lokal_web/controllers/user_registration_controller.ex
+++ b/lib/lokal_web/controllers/user_registration_controller.ex
@@ -3,7 +3,7 @@ defmodule LokalWeb.UserRegistrationController do
import LokalWeb.Gettext
alias Lokal.{Accounts, Invites}
alias Lokal.Accounts.User
- alias LokalWeb.{Endpoint, PageLive}
+ alias LokalWeb.{Endpoint, HomeLive}
def new(conn, %{"invite" => invite_token}) do
invite = Invites.get_invite_by_token(invite_token)
@@ -13,7 +13,7 @@ defmodule LokalWeb.UserRegistrationController do
else
conn
|> 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
@@ -23,7 +23,7 @@ defmodule LokalWeb.UserRegistrationController do
else
conn
|> 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
@@ -44,7 +44,7 @@ defmodule LokalWeb.UserRegistrationController do
else
conn
|> 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
@@ -54,7 +54,7 @@ defmodule LokalWeb.UserRegistrationController do
else
conn
|> 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
diff --git a/lib/lokal_web/controllers/user_settings_controller.ex b/lib/lokal_web/controllers/user_settings_controller.ex
index 22171f8..b6be99e 100644
--- a/lib/lokal_web/controllers/user_settings_controller.ex
+++ b/lib/lokal_web/controllers/user_settings_controller.ex
@@ -2,7 +2,7 @@ defmodule LokalWeb.UserSettingsController do
use LokalWeb, :controller
import LokalWeb.Gettext
alias Lokal.Accounts
- alias LokalWeb.{PageLive, UserAuth}
+ alias LokalWeb.{HomeLive, UserAuth}
plug :assign_email_and_password_changesets
@@ -93,7 +93,7 @@ defmodule LokalWeb.UserSettingsController do
conn
|> 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
conn
|> put_flash(:error, dgettext("errors", "Unable to delete user"))
diff --git a/lib/lokal_web/live/page_live.ex b/lib/lokal_web/live/home_live.ex
similarity index 97%
rename from lib/lokal_web/live/page_live.ex
rename to lib/lokal_web/live/home_live.ex
index b3499af..3bd671b 100644
--- a/lib/lokal_web/live/page_live.ex
+++ b/lib/lokal_web/live/home_live.ex
@@ -1,4 +1,4 @@
-defmodule LokalWeb.PageLive do
+defmodule LokalWeb.HomeLive do
@moduledoc """
Liveview for the main home page
"""
diff --git a/lib/lokal_web/live/page_live.html.leex b/lib/lokal_web/live/home_live.html.heex
similarity index 100%
rename from lib/lokal_web/live/page_live.html.leex
rename to lib/lokal_web/live/home_live.html.heex
diff --git a/lib/lokal_web/live/invite_live/form_component.ex b/lib/lokal_web/live/invite_live/form_component.ex
index f694d0d..c41c7e8 100644
--- a/lib/lokal_web/live/invite_live/form_component.ex
+++ b/lib/lokal_web/live/invite_live/form_component.ex
@@ -38,7 +38,9 @@ defmodule LokalWeb.InviteLive.FormComponent do
socket =
case invite |> Invites.update_invite(invite_params, current_user) do
{: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)
{:error, %Changeset{} = changeset} ->
@@ -56,7 +58,9 @@ defmodule LokalWeb.InviteLive.FormComponent do
socket =
case current_user |> Invites.create_invite(invite_params) do
{: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)
{:error, %Changeset{} = changeset} ->
diff --git a/lib/lokal_web/live/invite_live/index.ex b/lib/lokal_web/live/invite_live/index.ex
index e0a921b..72cfb55 100644
--- a/lib/lokal_web/live/invite_live/index.ex
+++ b/lib/lokal_web/live/invite_live/index.ex
@@ -6,7 +6,7 @@ defmodule LokalWeb.InviteLive.Index do
use LokalWeb, :live_view
import LokalWeb.Components.{InviteCard, UserCard}
alias Lokal.{Accounts, Invites, Invites.Invite}
- alias LokalWeb.{Endpoint, PageLive}
+ alias LokalWeb.{Endpoint, HomeLive}
alias Phoenix.LiveView.JS
@impl true
@@ -16,7 +16,7 @@ defmodule LokalWeb.InviteLive.Index do
socket |> display_invites()
else
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)
end
@@ -50,7 +50,7 @@ defmodule LokalWeb.InviteLive.Index do
%{name: invite_name} =
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()}
end
@@ -64,7 +64,9 @@ defmodule LokalWeb.InviteLive.Index do
|> Invites.update_invite(%{"uses_left" => nil}, current_user)
|> case do
{: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()
{:error, changeset} ->
@@ -84,7 +86,9 @@ defmodule LokalWeb.InviteLive.Index do
|> Invites.update_invite(%{"uses_left" => nil, "disabled_at" => nil}, current_user)
|> case do
{: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()
{:error, changeset} ->
@@ -106,7 +110,9 @@ defmodule LokalWeb.InviteLive.Index do
|> Invites.update_invite(%{"uses_left" => 0, "disabled_at" => now}, current_user)
|> case do
{: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()
{:error, changeset} ->
@@ -130,7 +136,7 @@ defmodule LokalWeb.InviteLive.Index do
) do
%{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()}
end
diff --git a/lib/lokal_web/live/invite_live/index.html.heex b/lib/lokal_web/live/invite_live/index.html.heex
index 1b8c864..657bed2 100644
--- a/lib/lokal_web/live/invite_live/index.html.heex
+++ b/lib/lokal_web/live/invite_live/index.html.heex
@@ -45,8 +45,8 @@
phx_value_id: invite.id,
data: [
confirm:
- dgettext("prompts", "Are you sure you want to delete the invite for %{name}?",
- name: invite.name
+ dgettext("prompts", "Are you sure you want to delete the invite for %{invite_name}?",
+ invite_name: invite.name
),
qa: "delete-#{invite.id}"
] do %>
@@ -70,8 +70,8 @@
phx-click="set_unlimited"
phx-value-id={invite.id}
data-confirm={
- dgettext("prompts", "Are you sure you want to make %{name} unlimited?",
- name: invite.name
+ dgettext("prompts", "Are you sure you want to make %{invite_name} unlimited?",
+ invite_name: invite.name
)
}
>
diff --git a/lib/lokal_web/router.ex b/lib/lokal_web/router.ex
index 4132179..a826ad1 100644
--- a/lib/lokal_web/router.ex
+++ b/lib/lokal_web/router.ex
@@ -35,7 +35,7 @@ defmodule LokalWeb.Router do
scope "/", LokalWeb do
pipe_through :browser
- live "/", PageLive
+ live "/", HomeLive
end
## Authentication routes
diff --git a/lib/lokal_web/templates/email/confirm_email.html.eex b/lib/lokal_web/templates/email/confirm_email.html.heex
similarity index 56%
rename from lib/lokal_web/templates/email/confirm_email.html.eex
rename to lib/lokal_web/templates/email/confirm_email.html.heex
index 99aee4e..5568a9b 100644
--- a/lib/lokal_web/templates/email/confirm_email.html.eex
+++ b/lib/lokal_web/templates/email/confirm_email.html.heex
@@ -3,23 +3,21 @@
<%= 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:") %>
-
+
-
<%= @url %>
+
<%= @url %>
-
+
- <%= dgettext("emails",
- "If you didn't create an account at %{name}, please ignore this.",
- name: "Lokal") %>
+ <%= dgettext("emails", "If you didn't create an account at Lokal, please ignore this.") %>
diff --git a/lib/lokal_web/templates/email/confirm_email.txt.eex b/lib/lokal_web/templates/email/confirm_email.txt.eex
index ca7867d..987f414 100644
--- a/lib/lokal_web/templates/email/confirm_email.txt.eex
+++ b/lib/lokal_web/templates/email/confirm_email.txt.eex
@@ -1,7 +1,7 @@
<%= 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:") %>
@@ -9,4 +9,4 @@
<%= dgettext("emails",
"If you didn't create an account at %{url}, please ignore this.",
- url: Routes.live_url(Endpoint, PageLive)) %>
+ url: Routes.live_url(Endpoint, HomeLive)) %>
diff --git a/lib/lokal_web/templates/email/reset_password.html.eex b/lib/lokal_web/templates/email/reset_password.html.heex
similarity index 58%
rename from lib/lokal_web/templates/email/reset_password.html.eex
rename to lib/lokal_web/templates/email/reset_password.html.heex
index 7fe79bf..87c46e2 100644
--- a/lib/lokal_web/templates/email/reset_password.html.eex
+++ b/lib/lokal_web/templates/email/reset_password.html.heex
@@ -3,17 +3,15 @@
<%= dgettext("emails", "Hi %{email},", email: @user.email) %>
-
<%= dgettext("emails", "You can reset your password by visiting the URL below:") %>
-
- <%= dgettext("emails",
- "If you didn't request this change from %{name}, please ignore this.",
- name: "Lokal") %>
+ <%= dgettext("emails", "If you didn't request this change from Lokal, please ignore this.") %>