D4no0

D4no0

Using liveview as root layout

Hello,
currently I have an application that uses liveview mostly. At the current moment I have popup menu with some other buttons that are handled in javascript. I wanted to refactor and change all the javascript with a liveview component.

The way I decided to move everything from app to a new liveview, and leave the app only as reference to liveview layout:
app.html.eex |> root_layout.html.leex |> other children layouts

Is there any downside to this approach? Or is it possible to refactor root layout to be liveview directly?

Most Liked

paulgoetze

paulgoetze

Hey, I’d would probably set up a root.html.eex, app.htlm.eex, and live.html.leex, as it was done in the live_view example app: Fix layouts · chrismccord/phoenix_live_view_example@c683680 · GitHub . This works for phoenix_live_view v0.10.0.

This allows you to have both routes with and without LiveView (e.g. if you just need a static page at some point or the like.)

Last Post!

D4no0

D4no0

This is what I currently have, this solves none of the problems. What I will end up doing most probably is to put multiple liveviews in root and allow communication between them via pubsub.

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New

Other popular topics Top

hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44139 214
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement