diff --git a/lib/epicenter/release.ex b/lib/epicenter/release.ex index 7037c685..8a1aa9ca 100644 --- a/lib/epicenter/release.ex +++ b/lib/epicenter/release.ex @@ -1,8 +1,7 @@ defmodule Epicenter.Release do alias Epicenter.Accounts alias Epicenter.AuditLog - alias EpicenterWeb.Endpoint - alias EpicenterWeb.Router.Helpers, as: Routes + use Phoenix.VerifiedRoutes, endpoint: EpicenterWeb.Endpoint, router: EpicenterWeb.Router @app :epicenter @@ -143,7 +142,7 @@ defmodule Epicenter.Release do defp generated_password_reset_url(user) do {:ok, %{body: body}} = Accounts.deliver_user_reset_password_instructions(user, fn encoded_token -> - Routes.user_reset_password_url(Endpoint, :edit, encoded_token) + url(~p"/users/reset-password/#{encoded_token}") end) [_body, url] = Regex.run(~r|\n(https?://[^\n]+)\n|, body) diff --git a/lib/epicenter_web.ex b/lib/epicenter_web.ex index d1771844..262caee7 100644 --- a/lib/epicenter_web.ex +++ b/lib/epicenter_web.ex @@ -23,7 +23,7 @@ defmodule EpicenterWeb do import Plug.Conn import Epicenter.Gettext - alias EpicenterWeb.Router.Helpers, as: Routes + use Phoenix.VerifiedRoutes, endpoint: EpicenterWeb.Endpoint, router: EpicenterWeb.Router end end @@ -49,6 +49,7 @@ defmodule EpicenterWeb do use PhoenixHTMLHelpers use Phoenix.LiveView, layout: {EpicenterWeb.LayoutView, :live} use EpicenterWeb.SearchHandling + use Phoenix.VerifiedRoutes, endpoint: EpicenterWeb.Endpoint, router: EpicenterWeb.Router unquote(view_helpers()) end @@ -81,6 +82,14 @@ defmodule EpicenterWeb do end end + def presenter do + quote do + use Phoenix.Component + use Phoenix.VerifiedRoutes, endpoint: EpicenterWeb.Endpoint, router: EpicenterWeb.Router + alias EpicenterWeb.Format + end + end + defp view_helpers do quote do # Use all HTML functionality (forms, tags, etc) @@ -97,7 +106,7 @@ defmodule EpicenterWeb do import Epicenter.Gettext import EpicenterWeb.ErrorHelpers - alias EpicenterWeb.Router.Helpers, as: Routes + use Phoenix.VerifiedRoutes, endpoint: EpicenterWeb.Endpoint, router: EpicenterWeb.Router end end diff --git a/lib/epicenter_web/controllers/import_controller.ex b/lib/epicenter_web/controllers/import_controller.ex index 07a9d3fa..7887d271 100644 --- a/lib/epicenter_web/controllers/import_controller.ex +++ b/lib/epicenter_web/controllers/import_controller.ex @@ -3,7 +3,6 @@ defmodule EpicenterWeb.ImportController do LiveView doesn't currently support file uploads, so this is a regular controller. It could probably be enhanced with some ajax or something. """ - use EpicenterWeb, :controller import EpicenterWeb.ControllerHelpers, only: [assign_defaults: 2] @@ -28,17 +27,17 @@ defmodule EpicenterWeb.ImportController do conn |> Session.set_last_csv_import_info(popped_import_info) - |> redirect(to: Routes.import_path(conn, :show)) + |> redirect(to: ~p"/import/complete") {:error, [user_readable: user_readable_message]} -> conn |> Session.set_import_error_message(user_readable_message) - |> redirect(to: Routes.import_start_path(conn, EpicenterWeb.ImportLive)) + |> redirect(to: ~p"/import/start") {:error, %DateParsingError{user_readable: user_readable_message}} -> conn |> Session.set_import_error_message(user_readable_message) - |> redirect(to: Routes.import_start_path(conn, EpicenterWeb.ImportLive)) + |> redirect(to: ~p"/import/start") end end diff --git a/lib/epicenter_web/controllers/root_controller.ex b/lib/epicenter_web/controllers/root_controller.ex index b6398c29..af690467 100644 --- a/lib/epicenter_web/controllers/root_controller.ex +++ b/lib/epicenter_web/controllers/root_controller.ex @@ -2,6 +2,6 @@ defmodule EpicenterWeb.RootController do use EpicenterWeb, :controller def show(conn, _params) do - conn |> redirect(to: Routes.people_path(conn, EpicenterWeb.PeopleLive)) + conn |> redirect(to: ~p"/people") end end diff --git a/lib/epicenter_web/controllers/user_auth.ex b/lib/epicenter_web/controllers/user_auth.ex index b6c20ba3..d26c5a8e 100644 --- a/lib/epicenter_web/controllers/user_auth.ex +++ b/lib/epicenter_web/controllers/user_auth.ex @@ -1,10 +1,9 @@ defmodule EpicenterWeb.UserAuth do import Plug.Conn - import Phoenix.Controller + use EpicenterWeb, :controller alias Epicenter.Accounts alias EpicenterWeb.Session - alias EpicenterWeb.Router.Helpers, as: Routes @doc """ Logs the user in. @@ -22,7 +21,7 @@ defmodule EpicenterWeb.UserAuth do user_token = Accounts.generate_user_session_token(user) user_return_to = get_session(conn, :user_return_to) - mfa_path = user.mfa_secret == nil && Routes.user_multifactor_auth_setup_path(conn, :new) + mfa_path = user.mfa_secret == nil && ~p"/users/mfa-setup" user_agent = get_req_header(conn, "user-agent") |> Euclid.Extra.List.first("user_agent_not_found") {:ok, _} = Accounts.create_login(%{session_id: user_token.id, user_agent: user_agent, user_id: user.id}) @@ -125,9 +124,9 @@ defmodule EpicenterWeb.UserAuth do they use the application at all, here would be a good place. """ def require_authenticated_user(conn, opts) do - login_path = Routes.user_session_path(conn, :new) - mfa_setup_path = Routes.user_multifactor_auth_setup_path(conn, :new) - mfa_path = Routes.user_multifactor_auth_path(conn, :new) + login_path = ~p"/users/login" + mfa_setup_path = ~p"/users/mfa-setup" + mfa_path = ~p"/users/mfa" error = case user_authentication_status(conn, opts) do diff --git a/lib/epicenter_web/controllers/user_multifactor_auth_setup_controller.ex b/lib/epicenter_web/controllers/user_multifactor_auth_setup_controller.ex index 9ce5504e..1f0d18b9 100644 --- a/lib/epicenter_web/controllers/user_multifactor_auth_setup_controller.ex +++ b/lib/epicenter_web/controllers/user_multifactor_auth_setup_controller.ex @@ -1,6 +1,5 @@ defmodule EpicenterWeb.UserMultifactorAuthSetupController do use EpicenterWeb, :controller - import EpicenterWeb.ControllerHelpers, only: [assign_defaults: 1] alias Epicenter.Accounts @@ -30,7 +29,7 @@ defmodule EpicenterWeb.UserMultifactorAuthSetupController do }} ) - conn |> Session.put_multifactor_auth_success(true) |> redirect(to: Routes.root_path(conn, :show)) + conn |> Session.put_multifactor_auth_success(true) |> redirect(to: ~p"/") {:error, message} -> conn diff --git a/lib/epicenter_web/controllers/user_reset_password_controller.ex b/lib/epicenter_web/controllers/user_reset_password_controller.ex index 58481e8a..bbfd0d93 100644 --- a/lib/epicenter_web/controllers/user_reset_password_controller.ex +++ b/lib/epicenter_web/controllers/user_reset_password_controller.ex @@ -1,6 +1,5 @@ defmodule EpicenterWeb.UserResetPasswordController do use EpicenterWeb, :controller - import EpicenterWeb.ControllerHelpers, only: [assign_defaults: 2] alias Epicenter.Accounts @@ -21,7 +20,7 @@ defmodule EpicenterWeb.UserResetPasswordController do {:ok, _} = Accounts.deliver_user_reset_password_instructions( user, - &Routes.user_reset_password_url(conn, :edit, &1) + &url(~p"/users/reset-password/#{&1}") ) else conn @@ -50,7 +49,7 @@ defmodule EpicenterWeb.UserResetPasswordController do {:ok, _} -> conn |> put_flash(:info, "Password reset successfully — please log in") - |> redirect(to: Routes.user_session_path(conn, :new)) + |> redirect(to: ~p"/users/login") {:error, changeset} -> conn |> assign_defaults(@common_assigns) |> render("edit.html", changeset: changeset) diff --git a/lib/epicenter_web/controllers/user_session_controller.ex b/lib/epicenter_web/controllers/user_session_controller.ex index bba614db..3db4ea04 100644 --- a/lib/epicenter_web/controllers/user_session_controller.ex +++ b/lib/epicenter_web/controllers/user_session_controller.ex @@ -1,6 +1,5 @@ defmodule EpicenterWeb.UserSessionController do use EpicenterWeb, :controller - import EpicenterWeb.ControllerHelpers, only: [assign_defaults: 2] alias Epicenter.Accounts @@ -44,7 +43,7 @@ defmodule EpicenterWeb.UserSessionController do with {:user, {:ok, user}} <- {:user, Accounts.register_user({new_user_attrs, audit_meta})}, {:token, {:ok, token}} <- {:token, Accounts.generate_user_reset_password_token(user)} do - conn |> redirect(to: Routes.user_reset_password_path(conn, :edit, token)) + conn |> redirect(to: ~p"/users/reset-password/#{token}") else {:user, {:error, %Ecto.Changeset{valid?: false} = changeset}} -> error_message = diff --git a/lib/epicenter_web/controllers/user_settings_controller.ex b/lib/epicenter_web/controllers/user_settings_controller.ex index 3743bd3b..8301e6b1 100644 --- a/lib/epicenter_web/controllers/user_settings_controller.ex +++ b/lib/epicenter_web/controllers/user_settings_controller.ex @@ -1,6 +1,5 @@ defmodule EpicenterWeb.UserSettingsController do use EpicenterWeb, :controller - import EpicenterWeb.ControllerHelpers, only: [assign_defaults: 2] alias Epicenter.Accounts @@ -30,7 +29,7 @@ defmodule EpicenterWeb.UserSettingsController do {:ok, user} -> conn |> put_flash(:info, "Password updated successfully") - |> put_session(:user_return_to, Routes.user_settings_path(conn, :edit)) + |> put_session(:user_return_to, ~p"/users/settings") |> UserAuth.log_in_user(user) {:error, changeset} -> diff --git a/lib/epicenter_web/live/add_visit_live.ex b/lib/epicenter_web/live/add_visit_live.ex index 4a3232f3..3470928b 100644 --- a/lib/epicenter_web/live/add_visit_live.ex +++ b/lib/epicenter_web/live/add_visit_live.ex @@ -56,7 +56,7 @@ defmodule EpicenterWeb.AddVisitLive do data = data |> Map.put(:place_id, socket.assigns.place.id), {:save, {:ok, _visit}} <- {:save, Cases.create_visit({data, audit_meta_create_visit(socket)})} do socket - |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") + |> push_navigate(to: ~p"/people/#{socket.assigns.case_investigation.person}/#case-investigations") |> noreply() else {:data, {:error, %Ecto.Changeset{} = form_changeset}} -> diff --git a/lib/epicenter_web/live/add_visit_live.html.heex b/lib/epicenter_web/live/add_visit_live.html.heex index 861f6a96..f84ada50 100644 --- a/lib/epicenter_web/live/add_visit_live.html.heex +++ b/lib/epicenter_web/live/add_visit_live.html.heex @@ -6,7 +6,7 @@ >
diff --git a/lib/epicenter_web/live/case_investigation_clinical_details_live.ex b/lib/epicenter_web/live/case_investigation_clinical_details_live.ex index be1cde30..2f3de6e5 100644 --- a/lib/epicenter_web/live/case_investigation_clinical_details_live.ex +++ b/lib/epicenter_web/live/case_investigation_clinical_details_live.ex @@ -132,7 +132,7 @@ defmodule EpicenterWeb.CaseInvestigationClinicalDetailsLive do {:form, {:ok, case_investigation_attrs}} <- {:form, ClinicalDetailsForm.case_investigation_attrs(form_changeset)}, {:case_investigation, {:ok, _case_investigation}} <- {:case_investigation, update_case_investigation(socket, case_investigation_attrs)} do socket - |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") + |> push_navigate(to: ~p"/people/#{socket.assigns.case_investigation.person}/#case-investigations") |> noreply() else {:form, {:error, form_changeset}} -> diff --git a/lib/epicenter_web/live/case_investigation_clinical_details_live.html.heex b/lib/epicenter_web/live/case_investigation_clinical_details_live.html.heex index 5b00eddc..ce12fb7c 100644 --- a/lib/epicenter_web/live/case_investigation_clinical_details_live.html.heex +++ b/lib/epicenter_web/live/case_investigation_clinical_details_live.html.heex @@ -5,7 +5,7 @@ >
diff --git a/lib/epicenter_web/live/case_investigation_conclude_isolation_monitoring_live.ex b/lib/epicenter_web/live/case_investigation_conclude_isolation_monitoring_live.ex index 88d20036..f5347044 100644 --- a/lib/epicenter_web/live/case_investigation_conclude_isolation_monitoring_live.ex +++ b/lib/epicenter_web/live/case_investigation_conclude_isolation_monitoring_live.ex @@ -80,7 +80,7 @@ defmodule EpicenterWeb.CaseInvestigationConcludeIsolationMonitoringLive do }} )} do socket - |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") + |> push_navigate(to: ~p"/people/#{socket.assigns.case_investigation.person}/#case-investigations") |> noreply() else {:form, {:error, %Ecto.Changeset{valid?: false} = form_changeset}} -> diff --git a/lib/epicenter_web/live/case_investigation_conclude_isolation_monitoring_live.html.heex b/lib/epicenter_web/live/case_investigation_conclude_isolation_monitoring_live.html.heex index 945b1548..2fecbb85 100644 --- a/lib/epicenter_web/live/case_investigation_conclude_isolation_monitoring_live.html.heex +++ b/lib/epicenter_web/live/case_investigation_conclude_isolation_monitoring_live.html.heex @@ -5,7 +5,7 @@ >
diff --git a/lib/epicenter_web/live/case_investigation_contact_live.ex b/lib/epicenter_web/live/case_investigation_contact_live.ex index 18ad44d9..eeab3258 100644 --- a/lib/epicenter_web/live/case_investigation_contact_live.ex +++ b/lib/epicenter_web/live/case_investigation_contact_live.ex @@ -201,7 +201,7 @@ defmodule EpicenterWeb.CaseInvestigationContactLive do data = data |> Map.put(:exposing_case_id, socket.assigns.case_investigation.id), {:created, {:ok, _}} <- {:created, create_or_update_contact_investigation(contact_investigation, data, socket.assigns.current_user)} do socket - |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") + |> push_navigate(to: ~p"/people/#{socket.assigns.case_investigation.person}/#case-investigations") |> noreply() else {:form, {:error, changeset}} -> diff --git a/lib/epicenter_web/live/case_investigation_contact_live.html.heex b/lib/epicenter_web/live/case_investigation_contact_live.html.heex index 42b5a95c..8bd3bc4a 100644 --- a/lib/epicenter_web/live/case_investigation_contact_live.html.heex +++ b/lib/epicenter_web/live/case_investigation_contact_live.html.heex @@ -5,7 +5,7 @@ >
diff --git a/lib/epicenter_web/live/case_investigation_discontinue_live.ex b/lib/epicenter_web/live/case_investigation_discontinue_live.ex index d62c9903..be0e3a85 100644 --- a/lib/epicenter_web/live/case_investigation_discontinue_live.ex +++ b/lib/epicenter_web/live/case_investigation_discontinue_live.ex @@ -48,7 +48,7 @@ defmodule EpicenterWeb.CaseInvestigationDiscontinueLive do }} ) do socket - |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") + |> push_navigate(to: ~p"/people/#{socket.assigns.case_investigation.person}/#case-investigations") |> noreply() else {:error, changeset} -> diff --git a/lib/epicenter_web/live/case_investigation_discontinue_live.html.heex b/lib/epicenter_web/live/case_investigation_discontinue_live.html.heex index 811e8687..9740dc01 100644 --- a/lib/epicenter_web/live/case_investigation_discontinue_live.html.heex +++ b/lib/epicenter_web/live/case_investigation_discontinue_live.html.heex @@ -6,7 +6,7 @@ >
diff --git a/lib/epicenter_web/live/case_investigation_isolation_monitoring_live.ex b/lib/epicenter_web/live/case_investigation_isolation_monitoring_live.ex index 928513f0..8b4012e0 100644 --- a/lib/epicenter_web/live/case_investigation_isolation_monitoring_live.ex +++ b/lib/epicenter_web/live/case_investigation_isolation_monitoring_live.ex @@ -87,7 +87,7 @@ defmodule EpicenterWeb.CaseInvestigationIsolationMonitoringLive do {:form, {:ok, model_attrs}} <- {:form, IsolationMonitoringForm.form_changeset_to_model_attrs(form_changeset)}, {:case_investigation, {:ok, _case_investigation}} <- {:case_investigation, update_case_investigation(socket, model_attrs)} do socket - |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") + |> push_navigate(to: ~p"/people/#{socket.assigns.case_investigation.person}/#case-investigations") |> noreply() else {:form, {:error, %Ecto.Changeset{valid?: false} = form_changeset}} -> diff --git a/lib/epicenter_web/live/case_investigation_isolation_monitoring_live.html.heex b/lib/epicenter_web/live/case_investigation_isolation_monitoring_live.html.heex index b216a84a..e9b6eae6 100644 --- a/lib/epicenter_web/live/case_investigation_isolation_monitoring_live.html.heex +++ b/lib/epicenter_web/live/case_investigation_isolation_monitoring_live.html.heex @@ -5,7 +5,7 @@ >
diff --git a/lib/epicenter_web/live/case_investigation_isolation_order_live.ex b/lib/epicenter_web/live/case_investigation_isolation_order_live.ex index 3136afab..c759d39e 100644 --- a/lib/epicenter_web/live/case_investigation_isolation_order_live.ex +++ b/lib/epicenter_web/live/case_investigation_isolation_order_live.ex @@ -62,7 +62,7 @@ defmodule EpicenterWeb.CaseInvestigationIsolationOrderLive do {:form, {:ok, model_attrs}} <- {:form, IsolationOrderForm.form_changeset_to_model_attrs(form_changeset)}, {:case_investigation, {:ok, _case_investigation}} <- {:case_investigation, update_case_investigation(socket, model_attrs)} do socket - |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") + |> push_navigate(to: ~p"/people/#{socket.assigns.case_investigation.person}/#case-investigations") |> noreply() else {:form, {:error, %Ecto.Changeset{valid?: false} = form_changeset}} -> diff --git a/lib/epicenter_web/live/case_investigation_isolation_order_live.html.heex b/lib/epicenter_web/live/case_investigation_isolation_order_live.html.heex index ae8a422b..f1bdeedf 100644 --- a/lib/epicenter_web/live/case_investigation_isolation_order_live.html.heex +++ b/lib/epicenter_web/live/case_investigation_isolation_order_live.html.heex @@ -5,7 +5,7 @@ >
diff --git a/lib/epicenter_web/live/case_investigation_start_interview_live.ex b/lib/epicenter_web/live/case_investigation_start_interview_live.ex index 71064c26..5e37127a 100644 --- a/lib/epicenter_web/live/case_investigation_start_interview_live.ex +++ b/lib/epicenter_web/live/case_investigation_start_interview_live.ex @@ -43,7 +43,7 @@ defmodule EpicenterWeb.CaseInvestigationStartInterviewLive do {:form, {:ok, cast_investigation_attrs}} <- {:form, StartInterviewForm.investigation_attrs(form_changeset)}, {:case_investigation, {:ok, _case_investigation}} <- {:case_investigation, update_case_investigation(socket, cast_investigation_attrs)} do socket - |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.case_investigation.person)}#case-investigations") + |> push_navigate(to: ~p"/people/#{socket.assigns.case_investigation.person}/#case-investigations") |> noreply() else {:form, {:error, %Ecto.Changeset{valid?: false} = form_changeset}} -> diff --git a/lib/epicenter_web/live/case_investigation_start_interview_live.html.heex b/lib/epicenter_web/live/case_investigation_start_interview_live.html.heex index 69b4a69f..4a674193 100644 --- a/lib/epicenter_web/live/case_investigation_start_interview_live.html.heex +++ b/lib/epicenter_web/live/case_investigation_start_interview_live.html.heex @@ -6,7 +6,7 @@ >
diff --git a/lib/epicenter_web/live/contact_investigation_clinical_details_live.ex b/lib/epicenter_web/live/contact_investigation_clinical_details_live.ex index d6ae0b65..e177248c 100644 --- a/lib/epicenter_web/live/contact_investigation_clinical_details_live.ex +++ b/lib/epicenter_web/live/contact_investigation_clinical_details_live.ex @@ -120,7 +120,7 @@ defmodule EpicenterWeb.ContactInvestigationClinicalDetailsLive do person = socket.assigns.contact_investigation.exposed_person socket - |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, person)}#contact-investigations") + |> push_navigate(to: ~p"/people/#{person}/#contact-investigations") |> noreply() else {:form, {:error, form_changeset}} -> diff --git a/lib/epicenter_web/live/contact_investigation_clinical_details_live.html.heex b/lib/epicenter_web/live/contact_investigation_clinical_details_live.html.heex index 4d18c4fb..61cbee70 100644 --- a/lib/epicenter_web/live/contact_investigation_clinical_details_live.html.heex +++ b/lib/epicenter_web/live/contact_investigation_clinical_details_live.html.heex @@ -4,7 +4,7 @@ >
diff --git a/lib/epicenter_web/live/contact_investigation_conclude_quarantine_monitoring_live.ex b/lib/epicenter_web/live/contact_investigation_conclude_quarantine_monitoring_live.ex index 4726b213..af7b064f 100644 --- a/lib/epicenter_web/live/contact_investigation_conclude_quarantine_monitoring_live.ex +++ b/lib/epicenter_web/live/contact_investigation_conclude_quarantine_monitoring_live.ex @@ -79,9 +79,7 @@ defmodule EpicenterWeb.ContactInvestigationConcludeQuarantineMonitoringLive do }} )} do socket - |> push_navigate( - to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.contact_investigation.exposed_person)}#contact-investigations" - ) + |> push_navigate(to: ~p"/people/#{socket.assigns.contact_investigation.exposed_person}/#contact-investigations") |> noreply() else {:form, {:error, %Ecto.Changeset{valid?: false} = form_changeset}} -> diff --git a/lib/epicenter_web/live/contact_investigation_conclude_quarantine_monitoring_live.html.heex b/lib/epicenter_web/live/contact_investigation_conclude_quarantine_monitoring_live.html.heex index 47b87c63..60160d50 100644 --- a/lib/epicenter_web/live/contact_investigation_conclude_quarantine_monitoring_live.html.heex +++ b/lib/epicenter_web/live/contact_investigation_conclude_quarantine_monitoring_live.html.heex @@ -5,7 +5,7 @@ >
diff --git a/lib/epicenter_web/live/contact_investigation_discontinue_live.ex b/lib/epicenter_web/live/contact_investigation_discontinue_live.ex index ff0bd2b5..bbf4bbbc 100644 --- a/lib/epicenter_web/live/contact_investigation_discontinue_live.ex +++ b/lib/epicenter_web/live/contact_investigation_discontinue_live.ex @@ -52,9 +52,7 @@ defmodule EpicenterWeb.ContactInvestigationDiscontinueLive do ) socket - |> push_navigate( - to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.contact_investigation.exposed_person)}#contact-investigations" - ) + |> push_navigate(to: ~p"/people/#{socket.assigns.contact_investigation.exposed_person}/#contact-investigations") |> noreply() else {:error, changeset} -> diff --git a/lib/epicenter_web/live/contact_investigation_discontinue_live.html.heex b/lib/epicenter_web/live/contact_investigation_discontinue_live.html.heex index fb78e698..3555beed 100644 --- a/lib/epicenter_web/live/contact_investigation_discontinue_live.html.heex +++ b/lib/epicenter_web/live/contact_investigation_discontinue_live.html.heex @@ -6,7 +6,7 @@ >
diff --git a/lib/epicenter_web/live/contact_investigation_quarantine_monitoring_live.ex b/lib/epicenter_web/live/contact_investigation_quarantine_monitoring_live.ex index 4696e94f..6cac0546 100644 --- a/lib/epicenter_web/live/contact_investigation_quarantine_monitoring_live.ex +++ b/lib/epicenter_web/live/contact_investigation_quarantine_monitoring_live.ex @@ -97,7 +97,7 @@ defmodule EpicenterWeb.ContactInvestigationQuarantineMonitoringLive do {:contact_investigation, {:ok, _contact_investigation}} <- {:contact_investigation, update_contact_investigation(socket, model_attrs)} do socket |> push_navigate( - to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.contact_investigation.exposed_person)}#case-investigations" + to: ~p"/people/#{socket.assigns.contact_investigation.exposed_person}/#case-investigations" ) |> noreply() else diff --git a/lib/epicenter_web/live/contact_investigation_quarantine_monitoring_live.html.heex b/lib/epicenter_web/live/contact_investigation_quarantine_monitoring_live.html.heex index b1346502..14adb39f 100644 --- a/lib/epicenter_web/live/contact_investigation_quarantine_monitoring_live.html.heex +++ b/lib/epicenter_web/live/contact_investigation_quarantine_monitoring_live.html.heex @@ -5,7 +5,7 @@ >
diff --git a/lib/epicenter_web/live/contact_investigation_start_interview_live.ex b/lib/epicenter_web/live/contact_investigation_start_interview_live.ex index ef31ccb9..85be12c3 100644 --- a/lib/epicenter_web/live/contact_investigation_start_interview_live.ex +++ b/lib/epicenter_web/live/contact_investigation_start_interview_live.ex @@ -44,9 +44,7 @@ defmodule EpicenterWeb.ContactInvestigationStartInterviewLive do {:contact_investigation, {:ok, _contact_investigation}} <- {:contact_investigation, update_contact_investigation(socket, cast_investigation_attrs)} do socket - |> push_navigate( - to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.contact_investigation.exposed_person)}#contact-investigations" - ) + |> push_navigate(to: ~p"/people/#{socket.assigns.contact_investigation.exposed_person}/#contact-investigations") |> noreply() else {:form, {:error, %Ecto.Changeset{valid?: false} = form_changeset}} -> diff --git a/lib/epicenter_web/live/contact_investigation_start_interview_live.html.heex b/lib/epicenter_web/live/contact_investigation_start_interview_live.html.heex index 45c1452c..6c0b4b59 100644 --- a/lib/epicenter_web/live/contact_investigation_start_interview_live.html.heex +++ b/lib/epicenter_web/live/contact_investigation_start_interview_live.html.heex @@ -6,7 +6,7 @@ >
diff --git a/lib/epicenter_web/live/contacts_live.ex b/lib/epicenter_web/live/contacts_live.ex index a12cbf8e..3bcc5ab8 100644 --- a/lib/epicenter_web/live/contacts_live.ex +++ b/lib/epicenter_web/live/contacts_live.ex @@ -8,10 +8,10 @@ defmodule EpicenterWeb.ContactsFilter do def render(assigns) do ~H"""
- <.link patch={Routes.contacts_path(@socket, EpicenterWeb.ContactsLive, filter: :with_contact_investigation)} class="button" data-active={to_string(assigns.filter in [:with_contact_investigation, nil])} data-role="contacts-filter" data-tid="all">All - <.link patch={Routes.contacts_path(@socket, EpicenterWeb.ContactsLive, filter: :with_pending_interview)} class="button" data-active={to_string(assigns.filter == :with_pending_interview)} data-role="contacts-filter" data-tid="with_pending_interview">Pending interview - <.link patch={Routes.contacts_path(@socket, EpicenterWeb.ContactsLive, filter: :with_ongoing_interview)} class="button" data-active={to_string(assigns.filter == :with_ongoing_interview)} data-role="contacts-filter" data-tid="with_ongoing_interview">Ongoing interview - <.link patch={Routes.contacts_path(@socket, EpicenterWeb.ContactsLive, filter: :with_quarantine_monitoring)} class="button" data-active={to_string(assigns.filter == :with_quarantine_monitoring)} data-role="contacts-filter" data-tid="with_quarantine_monitoring">Quarantine monitoring + <.link patch={~p"/contacts?filter=with_contact_investigation"} class="button" data-active={to_string(assigns.filter in [:with_contact_investigation, nil])} data-role="contacts-filter" data-tid="all">All + <.link patch={~p"/contacts?filter=with_pending_interview"} class="button" data-active={to_string(assigns.filter == :with_pending_interview)} data-role="contacts-filter" data-tid="with_pending_interview">Pending interview + <.link patch={~p"/contacts?filter=with_ongoing_interview"} class="button" data-active={to_string(assigns.filter == :with_ongoing_interview)} data-role="contacts-filter" data-tid="with_ongoing_interview">Ongoing interview + <.link patch={~p"/contacts?filter=with_quarantine_monitoring"} class="button" data-active={to_string(assigns.filter == :with_quarantine_monitoring)} data-role="contacts-filter" data-tid="with_quarantine_monitoring">Quarantine monitoring
""" |> Map.put(:root, true) diff --git a/lib/epicenter_web/live/contacts_live.html.heex b/lib/epicenter_web/live/contacts_live.html.heex index 2c75f73a..0c926518 100644 --- a/lib/epicenter_web/live/contacts_live.html.heex +++ b/lib/epicenter_web/live/contacts_live.html.heex @@ -49,7 +49,7 @@ <.link - navigate={Routes.profile_path(EpicenterWeb.Endpoint, EpicenterWeb.ProfileLive, person)} + navigate={~p"/people/#{person}"} data-role={"profile-link-#{person.id}"}> <%= full_name(person) %> diff --git a/lib/epicenter_web/live/demographics_edit_live.ex b/lib/epicenter_web/live/demographics_edit_live.ex index 68b4c0a1..490bc03f 100644 --- a/lib/epicenter_web/live/demographics_edit_live.ex +++ b/lib/epicenter_web/live/demographics_edit_live.ex @@ -130,7 +130,7 @@ defmodule EpicenterWeb.DemographicsEditLive do with %Ecto.Changeset{} = form_changeset <- DemographicForm.attrs_to_form_changeset(demographic_params), {:form, {:ok, model_attrs}} <- {:form, DemographicForm.form_changeset_to_model_attrs(form_changeset)}, {:model, {:ok, _model}} <- {:model, create_or_update_model(model_attrs, person, current_user)} do - socket |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, socket.assigns.person)}#demographics-data") |> noreply() + socket |> push_navigate(to: ~p"/people/#{socket.assigns.person}/#demographics-data") |> noreply() else {:form, {:error, %Ecto.Changeset{valid?: false} = form_changeset}} -> socket |> assign_form_changeset(form_changeset, "Check the errors above") |> noreply() diff --git a/lib/epicenter_web/live/demographics_edit_live.html.heex b/lib/epicenter_web/live/demographics_edit_live.html.heex index 96245f0a..1638bb28 100644 --- a/lib/epicenter_web/live/demographics_edit_live.html.heex +++ b/lib/epicenter_web/live/demographics_edit_live.html.heex @@ -6,7 +6,7 @@ >
diff --git a/lib/epicenter_web/live/investigation_complete_interview_live.ex b/lib/epicenter_web/live/investigation_complete_interview_live.ex index cdcff42d..de7ec7f5 100644 --- a/lib/epicenter_web/live/investigation_complete_interview_live.ex +++ b/lib/epicenter_web/live/investigation_complete_interview_live.ex @@ -52,7 +52,8 @@ defmodule EpicenterWeb.InvestigationCompleteInterviewLive do {:form, {:ok, case_investigation_attrs}} <- {:form, CompleteInterviewForm.investigation_attrs(form_changeset)}, {:investigation, {:ok, _investigation}} <- {:investigation, update_case_investigation(socket, case_investigation_attrs)} do socket - |> push_navigate(to: "#{Routes.profile_path(socket, EpicenterWeb.ProfileLive, get_person(socket.assigns.investigation))}#case-investigations") + |> push_navigate(to: + ~p"/people/#{get_person(socket.assigns.investigation)}/#case-investigations") |> noreply() else {:form, {:error, %Ecto.Changeset{valid?: false} = form_changeset}} -> diff --git a/lib/epicenter_web/live/investigation_complete_interview_live.html.heex b/lib/epicenter_web/live/investigation_complete_interview_live.html.heex index 4268afab..1c57bd89 100644 --- a/lib/epicenter_web/live/investigation_complete_interview_live.html.heex +++ b/lib/epicenter_web/live/investigation_complete_interview_live.html.heex @@ -5,7 +5,7 @@ >
diff --git a/lib/epicenter_web/live/people_live.ex b/lib/epicenter_web/live/people_live.ex index 4db49d2f..eba5a1f1 100644 --- a/lib/epicenter_web/live/people_live.ex +++ b/lib/epicenter_web/live/people_live.ex @@ -8,10 +8,10 @@ defmodule EpicenterWeb.PeopleFilter do def render(assigns) do ~H"""
- <.link patch={Routes.people_path(@socket, EpicenterWeb.PeopleLive, filter: :all)} class="button" data-active={to_string(assigns.filter in [:all, nil])} data-role="people-filter" data-tid="all">All - <.link patch={Routes.people_path(@socket, EpicenterWeb.PeopleLive, filter: :pending_interview)} class="button" data-active={to_string(assigns.filter == :pending_interview)} data-role="people-filter" data-tid="pending_interview">Pending interview - <.link patch={Routes.people_path(@socket, EpicenterWeb.PeopleLive, filter: :ongoing_interview)} class="button" data-active={to_string(assigns.filter == :ongoing_interview)} data-role="people-filter" data-tid="ongoing_interview">Ongoing interview - <.link patch={Routes.people_path(@socket, EpicenterWeb.PeopleLive, filter: :isolation_monitoring)} class="button" data-active={to_string(assigns.filter == :isolation_monitoring)} data-role="people-filter" data-tid="isolation_monitoring">Isolation monitoring + <.link patch={~p"/people?filter=all"} class="button" data-active={to_string(assigns.filter in [:all, nil])} data-role="people-filter" data-tid="all">All + <.link patch={~p"/people?filter=pending_interview"} class="button" data-active={to_string(assigns.filter == :pending_interview)} data-role="people-filter" data-tid="pending_interview">Pending interview + <.link patch={~p"/people?filter=ongoing_interview"} class="button" data-active={to_string(assigns.filter == :ongoing_interview)} data-role="people-filter" data-tid="ongoing_interview">Ongoing interview + <.link patch={~p"/people?filter=isolation_monitoring"} class="button" data-active={to_string(assigns.filter == :isolation_monitoring)} data-role="people-filter" data-tid="isolation_monitoring">Isolation monitoring