thiagomajesk

thiagomajesk

Hi! After working with some Phoenix 1.7 apps recently I was thinking about this…

Should we rename the “controllers” folder to something else? Like, “resources” maybe?

Now that things are collocated in the same folder and there are other things than just controllers, it kinda makes sense, no?

There’s one other thing I’d like to ask: Is there a reason why the layouts are now in the “components” folder? And… Wouldn’t make more sense if we moved it to… let’s say… “resources/layouts_html.ex” and “resources/layouts/*”?

I understand this hasn’t been done probably because of backward compatibility, but since it seems so natural to me, I’d like to as for your opinion as well. Have you thought about this yet?

Showing Posts 1 to 3

LostKobrakai

LostKobrakai

I’d expect layouts are in components, because they’re used “globally” and not for a specific controller or liveview. I’m not a big fan of the colocated templates, so I still create a views folder, which is used by both controllers and liveviews alike. That imo makes it much clearer that a template is independant of what it’s used for. With phoenix 1.7 it only became even simpler to just use the folder structure you want instead of the one given to you.

thiagomajesk

thiagomajesk OP

@LostKobrakai I was thinking about something like this:

- components/*
- resources/
  |_ blog_live/*
  |_ comment_live.ex
  |_ comment_live.html.heex
  |_ page_html/*
  |_ page_controller.ex
  |_ page_html.ex
  |_ layout_html/
  |_ layout_html.ex

This way, we’d have everything grouped together under “resources” (for instance) and the “components” folder would be free for what we usually consider UI components (like core components and others).

I personally find that if collocation were done like this, it would be very cool! It looks like everything is very well separated and well-identified.

I would also like to hear @chrismccord opinion about it, perhaps he has already thought about doing something like this in the past.

LostKobrakai

LostKobrakai

I sort folders to top, so folders and files will never be truely colocated.

— All posts loaded —

Where Next? Top

Trending in Proposals: Ideas Top

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews