diff --git a/lib/lokal/accounts/email.ex b/lib/lokal/accounts/email.ex index af2c37d..7c38e0a 100644 --- a/lib/lokal/accounts/email.ex +++ b/lib/lokal/accounts/email.ex @@ -27,21 +27,21 @@ defmodule Lokal.Email do @spec generate_email(key :: String.t(), User.t(), attrs :: map()) :: t() def generate_email("welcome", user, %{"url" => url}) do 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}) |> text_body(EmailView.render("confirm_email.txt", %{user: user, url: url})) end def generate_email("reset_password", user, %{"url" => url}) do 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}) |> text_body(EmailView.render("reset_password.txt", %{user: user, url: url})) end def generate_email("update_email", user, %{"url" => url}) do 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}) |> text_body(EmailView.render("update_email.txt", %{user: user, url: url})) end diff --git a/lib/lokal_web/components/topbar.ex b/lib/lokal_web/components/topbar.ex index a65bd15..7ec1416 100644 --- a/lib/lokal_web/components/topbar.ex +++ b/lib/lokal_web/components/topbar.ex @@ -6,7 +6,7 @@ defmodule LokalWeb.Components.Topbar do use LokalWeb, :component alias Lokal.Accounts - alias LokalWeb.{Endpoint, PageLive} + alias LokalWeb.{Endpoint, HomeLive} def topbar(assigns) do assigns = @@ -17,7 +17,7 @@ defmodule LokalWeb.Components.Topbar do
<%= 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:") %> -
+
- <%= @url %> + <%= @url %> -
+
- <%= 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.") %>
diff --git a/lib/lokal_web/templates/email/reset_password.txt.eex b/lib/lokal_web/templates/email/reset_password.txt.eex index 69bdec9..cf9efb3 100644 --- a/lib/lokal_web/templates/email/reset_password.txt.eex +++ b/lib/lokal_web/templates/email/reset_password.txt.eex @@ -7,4 +7,4 @@ <%= dgettext("emails", "If you didn't request this change from %{url}, please ignore this.", - url: Routes.live_url(Endpoint, PageLive)) %> + url: Routes.live_url(Endpoint, HomeLive)) %> diff --git a/lib/lokal_web/templates/email/update_email.html.eex b/lib/lokal_web/templates/email/update_email.html.heex similarity index 58% rename from lib/lokal_web/templates/email/update_email.html.eex rename to lib/lokal_web/templates/email/update_email.html.heex index d51e084..dc9a001 100644 --- a/lib/lokal_web/templates/email/update_email.html.eex +++ b/lib/lokal_web/templates/email/update_email.html.heex @@ -3,17 +3,18 @@ <%= dgettext("emails", "Hi %{email},", email: @user.email) %> -
+
<%= dgettext("emails", "You can change your email by visiting the URL below:") %> -
+
- <%= @url %> + <%= @url %> -
+
- <%= 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." + ) %> diff --git a/lib/lokal_web/templates/email/update_email.txt.eex b/lib/lokal_web/templates/email/update_email.txt.eex index 30d44f4..c23da11 100644 --- a/lib/lokal_web/templates/email/update_email.txt.eex +++ b/lib/lokal_web/templates/email/update_email.txt.eex @@ -7,4 +7,4 @@ <%= dgettext("emails", "If you didn't request this change from %{url}, please ignore this.", - url: Routes.live_url(Endpoint, PageLive)) %> + url: Routes.live_url(Endpoint, HomeLive)) %> diff --git a/lib/lokal_web/templates/error/error.html.heex b/lib/lokal_web/templates/error/error.html.heex index fadc170..eb6c10d 100644 --- a/lib/lokal_web/templates/error/error.html.heex +++ b/lib/lokal_web/templates/error/error.html.heex @@ -24,7 +24,7 @@
- + <%= dgettext("errors", "Go back home") %> diff --git a/lib/lokal_web/templates/layout/email.html.heex b/lib/lokal_web/templates/layout/email.html.heex index cdd068d..d11b566 100644 --- a/lib/lokal_web/templates/layout/email.html.heex +++ b/lib/lokal_web/templates/layout/email.html.heex @@ -9,11 +9,10 @@
- + <%= dgettext( "emails", - "This email was sent from %{name}, the self-hosted firearm tracker website.", - name: "Lokal" + "This email was sent from Lokal, the self-hosted firearm tracker website." ) %> diff --git a/lib/lokal_web/templates/layout/email.txt.eex b/lib/lokal_web/templates/layout/email.txt.eex index 09791c7..b3b1dda 100644 --- a/lib/lokal_web/templates/layout/email.txt.eex +++ b/lib/lokal_web/templates/layout/email.txt.eex @@ -7,6 +7,5 @@ ===================== <%= dgettext("emails", - "This email was sent from %{name} at %{url}, the self-hosted firearm tracker website.", - name: "Lokal", - url: Routes.live_url(Endpoint, PageLive)) %> + "This email was sent from Lokal at %{url}, the self-hosted firearm tracker website.", + url: Routes.live_url(Endpoint, HomeLive)) %> diff --git a/lib/lokal_web/templates/user_confirmation/new.html.heex b/lib/lokal_web/templates/user_confirmation/new.html.heex index b2a8552..64a7cf5 100644 --- a/lib/lokal_web/templates/user_confirmation/new.html.heex +++ b/lib/lokal_web/templates/user_confirmation/new.html.heex @@ -3,20 +3,19 @@ <%= dgettext("actions", "Resend confirmation instructions") %> - <%= form_for :user, - Routes.user_confirmation_path(@conn, :create), - [ - 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 -> %> + <.form + let={f} + for={:user} + action={Routes.user_confirmation_path(@conn, :create)} + class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center" + > <%= label(f, :email, class: "title text-lg text-primary-600") %> <%= email_input(f, :email, required: true, class: "input input-primary col-span-2") %> <%= submit(dgettext("actions", "Resend confirmation instructions"), class: "mx-auto btn btn-primary col-span-3" ) %> - <% end %> +
diff --git a/lib/lokal_web/templates/user_registration/new.html.heex b/lib/lokal_web/templates/user_registration/new.html.heex index b113baa..140a7ab 100644 --- a/lib/lokal_web/templates/user_registration/new.html.heex +++ b/lib/lokal_web/templates/user_registration/new.html.heex @@ -3,13 +3,12 @@ <%= dgettext("actions", "Register") %> - <%= form_for @changeset, - Routes.user_registration_path(@conn, :create), - [ - 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 -> %> + <.form + let={f} + for={@changeset} + action={Routes.user_registration_path(@conn, :create)} + class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center" + > <%= if @changeset.action && not @changeset.valid? do %>

@@ -40,7 +39,7 @@ <%= error_tag(f, :locale) %> <%= submit(dgettext("actions", "Register"), class: "mx-auto btn btn-primary col-span-3") %> - <% end %> +


diff --git a/lib/lokal_web/templates/user_reset_password/edit.html.heex b/lib/lokal_web/templates/user_reset_password/edit.html.heex index 8e56648..0fb7205 100644 --- a/lib/lokal_web/templates/user_reset_password/edit.html.heex +++ b/lib/lokal_web/templates/user_reset_password/edit.html.heex @@ -3,13 +3,12 @@ <%= dgettext("actions", "Reset password") %> - <%= form_for @changeset, - Routes.user_reset_password_path(@conn, :update, @token), - [ - 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 -> %> + <.form + let={f} + for={@changeset} + action={Routes.user_reset_password_path(@conn, :update, @token)} + class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center" + > <%= if @changeset.action && not @changeset.valid? do %>

@@ -34,7 +33,7 @@ <%= submit(dgettext("actions", "Reset password"), class: "mx-auto btn btn-primary col-span-3" ) %> - <% end %> +


diff --git a/lib/lokal_web/templates/user_reset_password/new.html.heex b/lib/lokal_web/templates/user_reset_password/new.html.heex index aae2fa4..af89ff6 100644 --- a/lib/lokal_web/templates/user_reset_password/new.html.heex +++ b/lib/lokal_web/templates/user_reset_password/new.html.heex @@ -3,20 +3,19 @@ <%= dgettext("actions", "Forgot your password?") %> - <%= form_for :user, - Routes.user_reset_password_path(@conn, :create), - [ - 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 -> %> + <.form + let={f} + for={:user} + action={Routes.user_reset_password_path(@conn, :create)} + class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center" + > <%= label(f, :email, class: "title text-lg text-primary-600") %> <%= email_input(f, :email, required: true, class: "input input-primary col-span-2") %> <%= submit(dgettext("actions", "Send instructions to reset password"), class: "mx-auto btn btn-primary col-span-3" ) %> - <% end %> +
diff --git a/lib/lokal_web/templates/user_session/new.html.heex b/lib/lokal_web/templates/user_session/new.html.heex index 15c77cd..d05f8a5 100644 --- a/lib/lokal_web/templates/user_session/new.html.heex +++ b/lib/lokal_web/templates/user_session/new.html.heex @@ -3,14 +3,13 @@ <%= dgettext("actions", "Log in") %> - <%= form_for @conn, - Routes.user_session_path(@conn, :create), - [ - as: :user, - 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 -> %> + <.form + let={f} + for={@conn} + action={Routes.user_session_path(@conn, :create)} + as="user" + class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center" + > <%= if @error_message do %>

@@ -31,7 +30,7 @@ <%= checkbox(f, :remember_me, class: "checkbox col-span-2") %> <%= submit(dgettext("actions", "Log in"), class: "mx-auto btn btn-primary col-span-3") %> - <% end %> +


diff --git a/lib/lokal_web/views/email_view.ex b/lib/lokal_web/views/email_view.ex index f81184d..d5ba376 100644 --- a/lib/lokal_web/views/email_view.ex +++ b/lib/lokal_web/views/email_view.ex @@ -2,7 +2,7 @@ defmodule LokalWeb.EmailView do @moduledoc """ A view for email-related helper functions """ - alias LokalWeb.{Endpoint, PageLive} + alias LokalWeb.{Endpoint, HomeLive} use LokalWeb, :view end diff --git a/lib/lokal_web/views/error_view.ex b/lib/lokal_web/views/error_view.ex index bca829e..1585b46 100644 --- a/lib/lokal_web/views/error_view.ex +++ b/lib/lokal_web/views/error_view.ex @@ -1,7 +1,7 @@ defmodule LokalWeb.ErrorView do use LokalWeb, :view import LokalWeb.Components.Topbar - alias LokalWeb.{Endpoint, PageLive} + alias LokalWeb.{Endpoint, HomeLive} def template_not_found(error_path, _assigns) do error_string = diff --git a/lib/lokal_web/views/page_view.ex b/lib/lokal_web/views/home_view.ex similarity index 100% rename from lib/lokal_web/views/page_view.ex rename to lib/lokal_web/views/home_view.ex diff --git a/lib/lokal_web/views/layout_view.ex b/lib/lokal_web/views/layout_view.ex index 3f82f70..528a1e5 100644 --- a/lib/lokal_web/views/layout_view.ex +++ b/lib/lokal_web/views/layout_view.ex @@ -1,7 +1,7 @@ defmodule LokalWeb.LayoutView do use LokalWeb, :view import LokalWeb.Components.Topbar - alias LokalWeb.{Endpoint, PageLive} + alias LokalWeb.{Endpoint, HomeLive} # Phoenix LiveDashboard is available only in development by default, # so we instruct Elixir to not warn if the dashboard route is missing. diff --git a/priv/gettext/actions.pot b/priv/gettext/actions.pot index 0b168d9..d5710d8 100644 --- a/priv/gettext/actions.pot +++ b/priv/gettext/actions.pot @@ -28,48 +28,48 @@ msgid "Delete User" msgstr "" #, 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_session/new.html.heex:45 +#: lib/lokal_web/templates/user_session/new.html.heex:44 msgid "Forgot your password?" msgstr "" #, elixir-autogen, elixir-format #: lib/lokal_web/components/topbar.ex:93 -#: lib/lokal_web/templates/user_confirmation/new.html.heex:30 -#: lib/lokal_web/templates/user_registration/new.html.heex:39 -#: lib/lokal_web/templates/user_reset_password/edit.html.heex:48 -#: lib/lokal_web/templates/user_reset_password/new.html.heex:30 +#: lib/lokal_web/templates/user_confirmation/new.html.heex:29 +#: lib/lokal_web/templates/user_registration/new.html.heex:38 +#: lib/lokal_web/templates/user_reset_password/edit.html.heex:47 +#: 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:33 +#: lib/lokal_web/templates/user_session/new.html.heex:32 msgid "Log in" msgstr "" #, elixir-autogen, elixir-format #: 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:33 -#: lib/lokal_web/templates/user_reset_password/edit.html.heex:43 -#: lib/lokal_web/templates/user_reset_password/new.html.heex:25 -#: lib/lokal_web/templates/user_session/new.html.heex:40 +#: lib/lokal_web/templates/user_registration/new.html.heex:32 +#: lib/lokal_web/templates/user_reset_password/edit.html.heex:42 +#: lib/lokal_web/templates/user_reset_password/new.html.heex:24 +#: lib/lokal_web/templates/user_session/new.html.heex:39 msgid "Register" msgstr "" #, elixir-autogen, elixir-format #: 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" msgstr "" #, 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:34 +#: lib/lokal_web/templates/user_reset_password/edit.html.heex:33 msgid "Reset password" msgstr "" #, 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" msgstr "" diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 8dd32d4..a15d086 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -44,7 +44,7 @@ msgid "Invites" msgstr "" #, 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" msgstr "" @@ -85,7 +85,7 @@ msgid "Settings" msgstr "" #, 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" msgstr "" @@ -95,12 +95,12 @@ msgid "Uses Left:" msgstr "" #, 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" msgstr "" #, elixir-autogen, elixir-format -#: lib/lokal_web/live/page_live.ex:13 +#: lib/lokal_web/live/home_live.ex:13 msgid "Home" msgstr "" @@ -158,3 +158,8 @@ msgstr "" #: lib/lokal_web/templates/user_settings/edit.html.heex:126 msgid "English" msgstr "" + +#, elixir-autogen, elixir-format +#: lib/lokal_web/components/user_card.ex:30 +msgid "User registered on" +msgstr "" diff --git a/priv/gettext/emails.pot b/priv/gettext/emails.pot index d9dd841..da7dcee 100644 --- a/priv/gettext/emails.pot +++ b/priv/gettext/emails.pot @@ -11,36 +11,20 @@ msgid "" msgstr "" #, elixir-autogen, elixir-format -#: lib/lokal/accounts/email.ex:30 -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.html.heex:3 #: 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/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 msgid "Hi %{email}," 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 #: lib/lokal_web/templates/email/confirm_email.txt.eex:10 msgid "If you didn't create an account at %{url}, please ignore this." 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 #: lib/lokal_web/templates/email/reset_password.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 "" #, elixir-autogen, elixir-format -#: lib/lokal/accounts/email.ex:37 -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.html.heex:8 #: lib/lokal_web/templates/email/update_email.txt.eex:4 msgid "You can change your email by visiting the URL below:" msgstr "" #, 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 msgid "You can confirm your account by visiting the URL below:" msgstr "" #, 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 msgid "You can reset your password by visiting the URL below:" 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 "" diff --git a/priv/gettext/errors.pot b/priv/gettext/errors.pot index b27e184..9ca434a 100644 --- a/priv/gettext/errors.pot +++ b/priv/gettext/errors.pot @@ -124,8 +124,8 @@ msgid "Not found" msgstr "" #, elixir-autogen, elixir-format -#: lib/lokal_web/templates/user_registration/new.html.heex:16 -#: lib/lokal_web/templates/user_reset_password/edit.html.heex:16 +#: lib/lokal_web/templates/user_registration/new.html.heex:15 +#: 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:64 #: lib/lokal_web/templates/user_settings/edit.html.heex:119 diff --git a/priv/gettext/prompts.pot b/priv/gettext/prompts.pot index ed248a8..9960783 100644 --- a/priv/gettext/prompts.pot +++ b/priv/gettext/prompts.pot @@ -70,37 +70,6 @@ msgstr "" msgid "Your account has been deleted" 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 #: lib/lokal_web/live/invite_live/index.html.heex:101 #: 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 "" #, 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 %{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 +#: lib/lokal_web/live/invite_live/index.ex:129 msgid "Copied to clipboard" msgstr "" @@ -136,3 +95,48 @@ msgstr "" #: lib/lokal_web/controllers/user_settings_controller.ex:65 msgid "Language updated successfully." 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 "" diff --git a/test/lokal_web/controllers/page_controller_test.exs b/test/lokal_web/controllers/page_controller_test.exs deleted file mode 100644 index d1e4ceb..0000000 --- a/test/lokal_web/controllers/page_controller_test.exs +++ /dev/null @@ -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 diff --git a/test/lokal_web/live/invite_live_test.exs b/test/lokal_web/live/invite_live_test.exs index 1e13405..262acb4 100644 --- a/test/lokal_web/live/invite_live_test.exs +++ b/test/lokal_web/live/invite_live_test.exs @@ -46,7 +46,8 @@ defmodule LokalWeb.InviteLiveTest do |> render_submit() |> 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" end @@ -70,7 +71,9 @@ defmodule LokalWeb.InviteLiveTest do |> follow_redirect(conn, Routes.invite_index_path(conn, :index)) 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" end diff --git a/test/lokal_web/live/page_live_test.exs b/test/lokal_web/live/page_live_test.exs index 52b33d9..e41a754 100644 --- a/test/lokal_web/live/page_live_test.exs +++ b/test/lokal_web/live/page_live_test.exs @@ -1,4 +1,4 @@ -defmodule LokalWeb.PageLiveTest do +defmodule LokalWeb.HomeLiveTest do use LokalWeb.ConnCase import Phoenix.LiveViewTest diff --git a/test/lokal_web/views/page_view_test.exs b/test/lokal_web/views/home_view_test.exs similarity index 100% rename from test/lokal_web/views/page_view_test.exs rename to test/lokal_web/views/home_view_test.exs