menu

package
v0.0.0-...-99b68d1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMenu

func NewMenu(conn db.Connection, data NewMenuData) (int64, error)

Types

type Item

type Item struct {
	Name         string `json:"name"`
	ID           string `json:"id"`
	Url          string `json:"url"`
	IsLinkUrl    bool   `json:"isLinkUrl"`
	Icon         string `json:"icon"`
	Header       string `json:"header"`
	Active       string `json:"active"`
	ChildrenList []Item `json:"childrenList"`
}

Item is an menu item.

type Menu struct {
	List        []Item              `json:"list"`
	Options     []map[string]string `json:"options"`
	MaxOrder    int64               `json:"maxOrder"`
	PluginName  string              `json:"pluginName"`
	ForceUpdate bool                `json:"forceUpdate"`
}

Menu contains list of menu items and other info.

func GetGlobalMenu

func GetGlobalMenu(user models.UserModel, conn db.Connection, lang string, pluginNames ...string) *Menu

GetGlobalMenu return Menu of given user model.

func (menu *Menu) AddMaxOrder()

AddMaxOrder add the max order of menu.

func (menu Menu) FormatPath() template.HTML

FormatPath get template.HTML for front-end.

func (menu *Menu) GetEditMenuList() []Item

GetEditMenuList return menu items list.

func (menu *Menu) GetUpdateJS(updateFlag bool) template.JS
func (menu *Menu) SetActiveClass(path string) *Menu

SetActiveClass set the active class of menu.

func (menu *Menu) SetMaxOrder(order int64)

SetMaxOrder set the max order of menu.

type NewMenuData

type NewMenuData struct {
	ParentId   int64  `json:"parent_id"`
	Type       int64  `json:"type"`
	Order      int64  `json:"order"`
	Title      string `json:"title"`
	Icon       string `json:"icon"`
	PluginName string `json:"plugin_name"`
	Uri        string `json:"uri"`
	Header     string `json:"header"`
	Uuid       string `json:"uuid"`
}

Jump to

Keyboard shortcuts

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