Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Item ¶
type Item struct { // Name is the name to display to the user Name string // Attr is one (or more) html attributes that should be on the <a> // element of this navbar item, this includes the href attribute Attr template.HTMLAttr // Perm is the permission required to see this item Perm radio.UserPermission }
Item is a single item that should be shown on a navigation bar, the simplest way to render these in a template would be:
`<a {{.Attr}}>{{.Name}}</a>`
func NewProtectedItem ¶
type NavBar ¶
type NavBar struct { // to the parent of the navbar items Attr template.HTMLAttr // contains filtered or unexported fields }
NavBar consists of the items that should be contained in a navigation bar on the website, items can be iterated by using the following template range {{range .NavBar.Values}} the dot will be set to each NavBarItem in order.
an example of rendering the whole navbar would be:
{{range .NavBar.Values}}<a {{.Attr}}>{{.Name}}</a>{{end}}
if you want to use a non-default ordering you need to call Get manually but remember that this might break if a name changes at a later point and so use of Get should always use {{with .NavBar.Get("name")}} to make sure the item actually exists
Click to show internal directories.
Click to hide internal directories.