I want to start by saying first, nothing I’m about to say it to belittle or undermine the efforts of others.
I respect your free labor and I respect the work you have already done for my benefit. Thank you!.
Ok with some of the formalities out of the way.
Issue #1
I just wanted to say. I hate modals for web forms!
Modal are great for:
- Alerts
- Confirmations
- Basic prompts and small feedback forms.
Modals are not so great for:
- Large forms
- Things that require large visual space
- Things that have managed state (Think clicking away from form before saving and losing your work)
We should not be using modals as a default example since many people will just stick with it.
First more times than not the form being generated is not small enough for a modal.
Second, one misstep and clicking away from the modal and you lose all your work in the form.
Third, its just ugly and it makes the form look and feel like a second rate citizen when it often deserves its own page.
Maybe the phx.gen.auth could generate a modal for login that seems to make more sense
I’m sure I’m not the only one who feels this way about the generated modal. I’d like to see what others think about good solutions for this.
Issues #2
I think in addition to the choice of modal use the way we use Index vs Show is also something that bothers me about Liveview generators.
#2:1
The fact you have two separate Liveviews that can in short basically do the same thing but only have a small variation from each other makes it more confusing for new comers since this is not something you see in may other frameworks.
I don’t think the saving you get sending a little bit of html over the wire vs just having it go to another LV via push_patch or push_navigate is worth mixing in the new/edit forms into both the index and show LV.
#2:2
Beyond confusion for the New / Edit forms via modals in both Index and Show the routes get a little wonkey as result of both edit/new forms in both the index and show LV.
I’ve starting to create what I call the “upsert” Liveview that represents both the new and edit form but as its own dedicated LV vs just an embeded modal via a LV component. Not saying its the best choice but I still find myself picking it over the default way.
Issue #3
live_sessions vs Authorization logic mixed in.
I still find working in layouts to be a real pain. LiveSessions made it possible to make it easier to make a segregated Admin section vs Normal users sections. This pattern feels at odds consolidating layouts and trying to make a single form for both admin users and normal users where conditions show elements not layouts.
This has been the biggest of the struggles for me when it comes to trying to find a pattern that works well for me.
I would really like to hear from others on #3 about how they are working with Admin logic mixed in their layouts vs making a whole admin section.
Final thoughts:
I would lke to have a constructive convo here so please be mindful of others who have done hard work to get us to this point before complaining or making a statement here. That said I think we can possibly do better on the issues I’ve outlined and I would like to know others also think. Thanks.