# `MishkaCmsBuilderWeb.Paths`
[🔗](https://github.com/mishka-group/mishka_cms_builder/blob/v0.0.1-alpha.2/lib/mishka_cms_builder_web/paths.ex#L5)

The visual editor's addresses, spelled in one place.

The editor owns how its own routes are written; the rest of the admin asks for them through
`runtime:document:editor_url` (`MishkaCmsCore.Runtime.Authoring.Section.editor_url/3`), which
`MishkaCmsBuilder.Plugins.EditorUrl` answers from `builder_path/3`. Inside the
editor — the error page's status strip, a component's own editor opened from a page, the share
link, a mention's notification — the same function writes every address, and `back_path/2`
honours only what it writes.

# `back_path`

```elixir
@spec back_path(String.t(), String.t() | nil) :: String.t()
```

Where the builder's back link goes: `return_to` when it names another builder, the section's list
otherwise.

THE ADDRESS IS SOMETHING A URL SUPPLIED, so it is matched on the builder's own prefix rather than
trusted. That prefix starts with a single `/`, which is what rules out `//elsewhere.example` and
`https://elsewhere.example` — a back link that could be pointed off-site is an open redirect with
the admin's session behind it.

# `builder_path`

```elixir
@spec builder_path(
  String.t() | atom(),
  String.t() | nil,
  MishkaCmsCore.Runtime.ErrorStatus.t() | nil
) ::
  String.t()
```

The builder's address for one document, or for making a new one when `id` is `nil`.

`status` names the error-page entry being edited. Without it an error page reopens on its 404
entry, which is not the one the author left.

THE ONE SPELLING. `back_path/2` honours an address by this prefix, so an address written out by
hand somewhere else is one the two could disagree about.

# `note_path`

```elixir
@spec note_path(String.t() | atom(), String.t(), String.t()) :: String.t()
```

The builder's address for one document, opened at one of its review notes.

The editor reads `?note=` on its connected mount: the Review sheet opens, the element the note is
about is selected and the note is marked. A note that is gone by the time the address is followed
opens the document as `builder_path/2` would.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
