menus

package
v0.5.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2022 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package menus provides an abstraction for providing an global menu that covers multiple sites

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Menu interface {
	Name() string
	AltText() string
	URL() *url.URL
	Children() []Menu
	Enabled(auth.Account) bool
}

Menu is an Interface to give the server infos about menuitems

type MenuItem struct {
	ItemName     string
	ItemAltText  string
	ItemURL      *url.URL
	ItemChildren []Menu
	RequireAuth  Rauth
}

MenuItem is an Implementation of the Menu Interface Enabled returns always true

func (m *MenuItem) AltText() string

AltText is for hovertext or Descriptions. Its can return "". to make templatemaking easier i decided to make an return required.

func (m *MenuItem) Children() []Menu

Children returns the ItemChildren or an empty Menu-Arry if ItemChildren is nil

func (m *MenuItem) Enabled(a auth.Account) bool

Enabled returns always true

func (m *MenuItem) Name() string

Name returns the name of the Item.

func (m *MenuItem) URL() *url.URL

URL returns the full URL of the item.

type MenuSite interface {
	Menu(string) []Menu
}

MenuSite is an interface that is fullfilled by sites to return an type of menu.

type Rauth

type Rauth int

Rauth is an type to idenitfy the need of the handlers.

const (
	ReqAuthAbsent   Rauth = -1
	ReqAuthUnspec   Rauth = 0
	ReqAuthRequired Rauth = 1
)

func (*Rauth) String

func (r *Rauth) String() string

String is to Statisfy the Stringer interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL