Add a `put_layout {MyAppWeb.LayoutView, "app.html"}` on `MyAppWeb` by default

41 vues
Accéder directement au premier message non lu

kelvin....@gmail.com

non lue,
26 mai 2020, 13:44:5526/05/2020
à phoenix-core
So, this came from a discussion in here: https://github.com/phoenixframework/phoenix/issues/3865
 
I think even though it would make no actual difference, as if we don't do that, `put_default_views` will do it for us, explicitness would benefit everyone.

I would go even further and actually change the default value of `put_default_views` to `false` in here: https://github.com/phoenixframework/phoenix/blob/f7784f86ed803a39eb45486f0e031e974e708818/lib/phoenix/controller.ex#L173

And also deprecate the use of that option in favor of being explicit on every controller of which view to use. I know it is a breaking change, but it is one that would enforce explicitness and would make the web code less "magic".

kelvin....@gmail.com

non lue,
26 mai 2020, 13:48:3426/05/2020
à phoenix-core
Going a little bit nuts now: I would even deprecate `put_view`, `put_layout` and `render` macros in favor of being explicit of which layout and which view to use for every render, but maybe that would be too much of a change 😂 

Chris McCord

non lue,
29 mai 2020, 13:00:2029/05/2020
à phoeni...@googlegroups.com
Every choice is a tradeoff, so it’s up to you to figure out which things you’d like to optimize for.  I think we strike a nice balance today.

--
You received this message because you are subscribed to the Google Groups "phoenix-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phoenix-core...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/phoenix-core/4b05c08c-9888-4cf0-8c7a-66e5b1c8380b%40googlegroups.com.

Chris McCord

non lue,
29 mai 2020, 13:00:2029/05/2020
à phoeni...@googlegroups.com
The ship has sailed on this possibility, but you are welcome to do it in your applications :)

--
You received this message because you are subscribed to the Google Groups "phoenix-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phoenix-core...@googlegroups.com.

Allen Madsen

non lue,
29 mai 2020, 16:55:3029/05/2020
à phoenix-core
What about adding put_layout and put_view as explicit calls in the generators?

Allen Madsen

non lue,
29 mai 2020, 16:58:1729/05/2020
à phoenix-core
By generators I meant the controller generator, not the MyAppWeb one.

José Valim

non lue,
29 mai 2020, 17:28:0329/05/2020
à phoeni...@googlegroups.com
In my opinion it is unnecessary noise once you get familiar with the convention.

The only reason why put_root_layout is not also automatically done is backwards compatibility.

Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message