Back to godoc.org

Package menu

v1.2.15
Latest Go to latest
Published: Aug 4, 2020 | License: Apache-2.0 | Module: github.com/GoAdminGroup/go-admin

Index

Package Files

func NewMenu

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

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, 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"`
}
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier