Bloccs.Web.Router (bloccs_web v0.1.0)

Copy Markdown View Source

Router helpers for mounting the bloccs dashboard into a host Phoenix app.

Add one macro call inside a scope and pipe it through whatever auth your app already uses:

defmodule MyAppWeb.Router do
  use MyAppWeb, :router
  import Bloccs.Web.Router

  scope "/" do
    pipe_through [:browser, :require_admin]
    bloccs_dashboard "/bloccs"
  end
end

The dashboard inherits the host's auth from the pipeline; per-feature authorization (the Pro seam) is delegated to a Bloccs.Web.Resolver.

Summary

Functions

Mount the bloccs dashboard at path.

Functions

bloccs_dashboard(path, opts \\ [])

(macro)

Mount the bloccs dashboard at path.

Options

  • :resolver — a module implementing Bloccs.Web.Resolver, consulted for the current user, access level, and enabled features. Defaults to Bloccs.Web.Access (everything visible — the free baseline).
  • :as — the route helper name. Defaults to :bloccs_dashboard.
  • :on_mount — extra on_mount hooks appended to the dashboard's own.

All four panels live under a single live_session so navigating between them never triggers a full remount.