Liking cljdoc? Tell your friends :D

wagoe.platform.core.http.nav

The sidebar navigation modules contribute, as data.

A module's route contribution may carry :nav, groups by id:

{:user {:label [:t :user/nav-title] :icon :users :entities [:users] ; admin entities this module owns :items [{:href "/web/audit" :label .. :icon :file-text :access :platform-admin :description ..}]}} ; optional, for dashboard cards

An item with :entity (the admin contributes one per entity) is placed by module: its :module, else the group whose :entities names it, else :other. Other items stay in the group that declared them.

The platform binds *nav* around each request, so a page renders the whole sidebar without depending on the modules in it.

The sidebar navigation modules contribute, as data.

A module's route contribution may carry `:nav`, groups by id:

  {:user {:label    [:t :user/nav-title]
          :icon     :users
          :entities [:users]          ; admin entities this module owns
          :items    [{:href "/web/audit" :label .. :icon :file-text
                      :access :platform-admin
                      :description ..}]}}  ; optional, for dashboard cards

An item with `:entity` (the admin contributes one per entity) is placed by
module: its `:module`, else the group whose `:entities` names it, else
`:other`. Other items stay in the group that declared them.

The platform binds `*nav*` around each request, so a page renders the whole
sidebar without depending on the modules in it.
raw docstring

*nav*clj

{:groups [..] :uri ".."} for the request being handled: every module's groups, ordered (or a delay of them), and the path asked for. nil outside a request.

`{:groups [..] :uri ".."}` for the request being handled: every module's
groups, ordered (or a delay of them), and the path asked for. nil outside a
request.
sourceraw docstring

allowed?clj

(allowed? access user)

Whether user may open a page guarded by access. The one place nav asks who may see what: :platform-admin, :admin, nil for anyone signed in, or a fn of the signed-in user, for a module that checks permissions itself (the admin under ADR-041 §6).

Whether `user` may open a page guarded by `access`. The one place nav asks
who may see what: `:platform-admin`, `:admin`, nil for anyone signed in, or
a fn of the signed-in user, for a module that checks permissions itself
(the admin under ADR-041 §6).
sourceraw docstring

collectclj

(collect contributions order mounted?)

One ordered vector of groups from contributions, each a module's :nav map or a function returning one, in module order. order lists group ids that come first; the rest keep contribution order, and :other comes last. Items whose page mounted? denies are dropped, and then empty groups. An entity item is not asked: its page is a parameter of the admin's route, and the admin contributes it only when mounted.

One ordered vector of groups from `contributions`, each a module's `:nav`
map or a function returning one, in module order. `order` lists group ids that come first; the rest
keep contribution order, and `:other` comes last. Items whose page
`mounted?` denies are dropped, and then empty groups. An entity item is not
asked: its page is a parameter of the admin's route, and the admin
contributes it only when mounted.
sourceraw docstring

for-userclj

(for-user groups uri user)

groups with only the items user may open. The item whose href is the longest prefix of uri is :active?, and its group :open?.

`groups` with only the items `user` may open. The item whose href is the
longest prefix of `uri` is `:active?`, and its group `:open?`.
sourceraw docstring

other-groupclj

Where an entity no module claims goes.

Where an entity no module claims goes.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close