So it does look like I have plug :put_root_layout, {MyAppWeb.LayoutView, :root}
in the :browser
pipeline in router.ex
, here’s what the full router looks like:
defmodule MyAppWeb.Router do
use MyAppWeb, :router
use Pow.Phoenix.Router
import Phoenix.LiveDashboard.Router
use Pow.Extension.Phoenix.Router,
extensions: [PowResetPassword, PowEmailConfirmation]
use Plug.ErrorHandler
alias MyAppWeb.{
APIAuthentication,
AppDomainRedirect,
BrowserAuthentication,
RequirePermission
}
defp handle_errors(conn, error_data) do
MyAppWeb.ErrorReporter.handle_errors(conn, error_data)
end
if Mix.env() == :dev do
forward "/sent_emails", Bamboo.SentEmailViewerPlug
end
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
plug :put_root_layout, {MyAppWeb.LayoutView, :root}
plug AppDomainRedirect
plug BrowserAuthentication, otp_app: :my_app
end
pipeline :api do
plug :accepts, ["json"]
plug APIAuthentication, otp_app: :my_app
end
pipeline :require_admin do
plug RequirePermission, permission: :administrator
end
pipeline :protected do
plug Pow.Plug.RequireAuthenticated,
error_handler: Pow.Phoenix.PlugErrorHandler
end
pipeline :anonymous do
plug Pow.Plug.RequireNotAuthenticated, error_handler: Pow.Phoenix.PlugErrorHandler
end
pipeline :not_authenticated do
plug Pow.Plug.RequireNotAuthenticated,
error_handler: GlobalImpactWeb.AuthErrorHandler
end
scope "/" do
pipe_through :browser
pow_routes()
pow_extension_routes()
end
scope "/", MyAppWeb do
pipe_through [:browser, :not_authenticated]
get "/sign_up", RegistrationController, :new, as: :signup
post "/sign_up", RegistrationController, :create, as: :signup
end
scope "/", MyAppWeb do
pipe_through [:browser, :protected]
get "/", PageController, :index
get "/styleguide", StyleguideController, :styleguide
end
scope "/", MyAppWeb do
pipe_through [:browser, :protected, :require_admin]
get "/projects", ProjectsController, :index
get "/configurations", ConfigurationsController, :index
end
if Mix.env() == :dev do
scope "/" do
pipe_through :browser
live_dashboard "/dashboard", metrics: MyApp.Telemetry
end
end
scope "/admin" do
pipe_through [:browser, :protected, :require_admin]
forward("/", Adminable.Plug,
otp_app: :global_impact,
repo: GlobalImpact.Repo,
schemas: [MyApp.User, GlobalImpact.Organization],
view_module: MyAppWeb.Adminable.AdminView,
layout: {MyAppWeb.LayoutView, "app.html"}
)
end
scope "/images" do
pipe_through([:browser, :protected])
forward("/sign", Transmit,
signer: Transmit.S3Signer,
bucket: "global-impact",
path: "uploads"
)
end
scope "/api", MyAppWeb.API, as: :api do
pipe_through [:api]
get "/", MeController, :show
end
end