Im using a controller the render a live view, because I need to set breadcrumbs for the template. The problem is that my live view is using live_link/2
for pagination, and using a controller instead of the live/3
macro, i wont be able to use live_link().
I saw that there is a router: someRouter
option for live_render/3
but not sure how to implement it, anyone got any clues?
EDIT
I solved the problem by creating a plug and match on request_path.
defmodule FigurismWeb.Plug.BreadcrumbsPlug do
use Breadcrumble
def init(opts), do: opts
def call(%Plug.Conn{:request_path => "/admin/users"} = conn, _opts) do
conn
|> add_breadcrumb(name: "Dashboard", url: "/admin/dashboard")
|> add_breadcrumb(name: "Users")
end
def call(conn, _opts), do: conn
end
And routes:
pipeline :admin do
plug FigurismWeb.Plug.BreadcrumbsPlug
end
I think this is an ok solution until you get a lot of live macros, so im still curious on how to use the routes: Someroute
options for live_render