Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddMenuToMapFromEtree ¶
AddMenuToMapFromEtree reads the menu from the given element and adds it to the given map.
func BootStrap ¶
func BootStrap()
BootStrap the menus by linking parents and children and populates the Registry
func LoadFromEtree ¶
LoadFromEtree reads the menu given etree.Element, creates or updates the menu and adds it to the menu registry if it not already.
Types ¶
type Collection ¶
A Collection is a hierarchical and sortable Collection of menus
var (
Registry *Collection
)
Registry is the menu Collection of the application
func NewCollection ¶
func NewCollection() *Collection
NewCollection returns a pointer to a new Collection instance
func (*Collection) All ¶ added in v0.1.0
func (mc *Collection) All() []*Menu
All returns all menus recursively
func (*Collection) GetByID ¶
func (mc *Collection) GetByID(id int64) *Menu
GetByID returns the Menu with the given id
func (*Collection) GetByXMLID ¶ added in v0.1.0
func (mc *Collection) GetByXMLID(xmlid string) *Menu
GetByXMLID returns the Menu with the given xmlid
func (*Collection) Len ¶
func (mc *Collection) Len() int
func (*Collection) Less ¶
func (mc *Collection) Less(i, j int) bool
func (*Collection) Swap ¶
func (mc *Collection) Swap(i, j int)
type Menu ¶
type Menu struct { ID int64 XMLID string Name string ParentID string Parent *Menu ParentCollection *Collection Children *Collection Sequence uint8 ActionID string Action *actions.Action HasChildren bool HasAction bool WebIcon string // contains filtered or unexported fields }
A Menu is the representation of a single menu item
func (Menu) TranslatedName ¶
TranslatedName returns the translated name of this menu in the given language