I would like to render different template files based on some values in
assigns. By default my liveview is named
menu.ex and as such renders the template file
menu.html.heex. The menu structure based on the URI path is dynamic and quite complex and as such I did not define it in
router.ex except for
live "/*path", MainLive.Menu.
I would like to customize the chosen file by defining a
render function in my liveview but I don’t know what I need to put inside of it to get a proper
Phoenix.LiveView.Rendered struct since I do not use
Phoenix.View. I guess using
~H would not do the trick.
Previously, in another PoC project, I had used the following code with
def render(assigns) do case assigns.live_action do :index -> LVWeb.LVView.render("lv_live.index.html", assigns) :site -> LVWeb.LVView.render("lv_live.site.html", assigns) :turbine -> LVWeb.LVView.render("lv_live.turbine.html", assigns) _ -> LVWeb.LVView.render("lv_live.index.html", assigns) end end