Improved prefix support for verified routes

Aperta
#6,501 7 commenti 2 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
42/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
elixir
Ambito
backend, web-dev

Direzione di ricerca

Start at Phoenix.VerifiedRoutes and trace how the existing path_prefixes option is parsed and applied to ~p routes. Define the route-dependent behavior for :locale prefixes, including coexistence with unprefixed routes and multiple prefixes, then verify the implementation against the proposed syntax.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

use Phoenix.VerifiedRoutes currently supports path_prefixes: [{Gettext, :get_locale, []}] as an option. This is quite limiting though, because it's a static prefix set per module (per use call). ~p"/somewhere" implicitly gets the prefix applied based on context alone.

Often prefixes also happen to be mixed in with non prefixed routes in templates (e.g. in the app layout) and the need for distinct modules makes this confusing.

I'm proposing changing the option to path_prefixes: %{"locale" => {Gettext, :get_locale, []}}, which makes applying the prefix depend on the route provided like so: ~p"/:locale/somewhere". This clearly indicates the use of a prefix, while allowing for multiple prefixes as well as no prefix to coexist.

Lingua principale
Elixir
Stelle
23.2k
Fork
3.2k
Merge medio
1g 3h
PR unite (30g)
23

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di phoenixframework/phoenix

Tutte le issue di phoenixframework/phoenix

Issue simili

Altre issue su Elixir

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.