Improved prefix support for verified routes

オープン
#6,501 コメント 7 件 リアクション 2 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
elixir
領域
backend, web-dev

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Elixir
スター
23.2k
フォーク
3.2k
平均マージ
22時間 45分
マージ済み PR(30日)
21

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

phoenixframework/phoenix のほかの issue

phoenixframework/phoenix の issue をすべて見る

似ている issue

Elixir の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。