feat: add task liveview

This commit is contained in:
Moritz Böhme 2025-04-06 17:24:21 +02:00
parent efa5489225
commit 26b33060ee
4 changed files with 271 additions and 25 deletions

View file

@ -24,7 +24,26 @@ defmodule PutzplanWeb.Router do
scope "/", PutzplanWeb do
pipe_through :browser
get "/", PageController, :home
auth_routes AuthController, Putzplan.Accounts.User, path: "/auth"
sign_out_route AuthController
# Remove these if you'd like to use your own authentication views
sign_in_route register_path: "/register",
auth_routes_prefix: "/auth",
on_mount: [{PutzplanWeb.LiveUserAuth, :live_no_user}],
overrides: [
PutzplanWeb.AuthOverrides,
AshAuthentication.Phoenix.Overrides.Default
]
ash_authentication_live_session :authenticated_routes do
live "/tasks", TaskLive.Index, :index
live "/tasks/new", TaskLive.Index, :new
live "/tasks/:id/edit", TaskLive.Index, :edit
live "/tasks/:id", TaskLive.Show, :show
live "/tasks/:id/show/edit", TaskLive.Show, :edit
# in each liveview, add one of the following at the top of the module:
#
# If an authenticated user must be present:
@ -38,31 +57,6 @@ defmodule PutzplanWeb.Router do
end
end
scope "/", PutzplanWeb do
pipe_through :browser
get "/", PageController, :home
auth_routes AuthController, Putzplan.Accounts.User, path: "/auth"
sign_out_route AuthController
# Remove these if you'd like to use your own authentication views
sign_in_route register_path: "/register",
reset_path: "/reset",
auth_routes_prefix: "/auth",
on_mount: [{PutzplanWeb.LiveUserAuth, :live_no_user}],
overrides: [
PutzplanWeb.AuthOverrides,
AshAuthentication.Phoenix.Overrides.Default
]
# Remove this if you do not want to use the reset password feature
reset_route auth_routes_prefix: "/auth",
overrides: [
PutzplanWeb.AuthOverrides,
AshAuthentication.Phoenix.Overrides.Default
]
end
# Other scopes may use custom stacks.
# scope "/api", PutzplanWeb do
# pipe_through :api