Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Determine how to best handle root routing for a concern #79

Open
dsnider opened this issue Jun 28, 2017 · 1 comment
Open

Determine how to best handle root routing for a concern #79

dsnider opened this issue Jun 28, 2017 · 1 comment

Comments

@dsnider
Copy link
Member

dsnider commented Jun 28, 2017

This is sticker than it should be. Phoenix routes to a specific controller but we're using a shared controller approach. Although we can easily change the default resource by overriding Concern.default_page/0, that's only part of the picture. We need to specify the corresponding controller in the router. Further, our load_concern plug expects the resource param loaded by Phoenix router. Without that, it assumes it's a page.

The best way may be a plug that uses the default_page (that may have a page or backed resource) and determines the appropriate controller. See this:

https://elixirforum.com/t/does-router-support-glob-like-a-e/2863/4

It would also have to configure the resource, if needed. I'm not sure it's worth adding more complexity to handle this right now

On a related note, we can consider offloading the root route handling to the target project. This would more easily allow the user to select what page/resource to use for the root route (e.g. /admin) without needing any additional plug/controller handling in Talon. To make this easier for the user, we could generate the router boiler plate as:

scope "/#{route_scope}", #{namespace} do
  pipe_through :browser
  talon_routes(#{to_s full_concern})
  get "/", page_controller, :index
end

I thought this would give us everything, but it doesn't because of our LoadConcern plug. Either way, it might still be more flexible. I'm still inclined to punt on this for the time being.

@smpallen99
Copy link
Member

I agree, this is not a high priority item. I think there are more important issues to focus on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants