enhancementhelp wanted
説明
The issue: when developing in phoenix (phx) we want to have a custom path for our Coherence resources. But we currently can't.
In the current file lib/router.ex the resource paths are hardcoded, instead we can have them as default arguments to that they can be customized in each project.
For example:
defmodule Coherence.Router do
...
defmacro coherence_routes(mode \\ [], opts \\ []) do # <--- we have an opportunity here
....
if Coherence.Config.has_action?(:registerable, :new) do
get "/registrations/new", Coherence.RegistrationController, :new
end
# And we use this macro in our Phx router as:
coherence_routes()
While we could do something like this:
defmodule Coherence.Router do
...
defmacro coherence_routes(mode \\ [], opts \\ [:registrations_path: "registrations", ...]) do
....
if Coherence.Config.has_action?(:registerable, :new) do
get "/#{opts[:registrations_path]}/new", Coherence.RegistrationController, :new
end
# And we use this macro in our Phx router as:
coherence_routes([], [:registrations_path: "accounts"])
I could prepare and open a PR to address that 👍 What do you think?