Skip to main content

Module urls

Module urls 

Source
Expand description

Named URL patterns + Tera helper registration.

Registered via rustango::register_url!: every admin route gets a stable name (rcms-admin:pages:list, rcms-admin:pages:edit, …) so templates resolve URLs through {{ url(name="…") }} instead of hard-coding /cms-admin/... strings. Mount-prefix changes only need one edit in this file.

§Wire-up

Calling crate::admin::register_templates also calls register_tera_helpers, which registers:

  • {{ url(name=…, kwarg=…) }} — named URL reversal (rustango::urls).
  • {{ "…" | querystring(…) }} — URL query-string builder for pagination + filter links.
  • {{ ts | naturaltime }}, intcomma, naturalsize, ordinal, etc. — humanize filters (rustango::humanize).
  • {{ csrf_token | csrf_input | safe }} — hidden-input shape of the CSRF token (rustango::forms::csrf).

No-op on the registry-name side: rustango::register_url! submits each pattern through inventory, so the names are live the moment this module is linked into the binary.

Functions§

duplicate_url_names
Surface duplicate URL-pattern names at boot. Returns a list of names registered more than once; empty list means clean. Re-exports rustango::urls::duplicates for callers that don’t want to depend on the framework module directly.
register_tera_helpers
Register every Tera function / filter the bundled admin templates rely on. Called from crate::admin::register_templates; host apps don’t need to call it themselves unless they’re building Tera without the admin templates.