navigate

package
v2.2.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: AGPL-3.0 Imports: 4 Imported by: 0

README

后台导航菜单

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyList = List{}

EmptyList 空菜单列表

View Source
var LeftNavigate = defaultNavigate

LeftNavigate 左边导航菜单

View Source
var TopNavigate = &List{
	{
		DisplayOnMenu: true,
		Name:          `设置`,
		Action:        `manager`,
		Icon:          `gear`,
		Children: &List{
			{
				DisplayOnMenu: true,
				Name:          `系统设置`,
				Action:        `settings`,
			},

			{
				DisplayOnMenu: true,
				Name:          `元数据`,
				Action:        `kv`,
			},
			{
				DisplayOnMenu: false,
				Name:          `添加元数据`,
				Action:        `kv_add`,
			},
			{
				DisplayOnMenu: false,
				Name:          `修改元数据`,
				Action:        `kv_edit`,
			},
			{
				DisplayOnMenu: false,
				Name:          `删除元数据`,
				Action:        `kv_delete`,
			},

			{
				DisplayOnMenu: true,
				Name:          `警报收信账号`,
				Action:        `alert_recipient`,
			},
			{
				DisplayOnMenu: false,
				Name:          `添加警报收信账号`,
				Action:        `alert_recipient_add`,
			},
			{
				DisplayOnMenu: false,
				Name:          `修改警报收信账号`,
				Action:        `alert_recipient_edit`,
			},
			{
				DisplayOnMenu: false,
				Name:          `删除警报收信账号`,
				Action:        `alert_recipient_delete`,
			},

			{
				DisplayOnMenu: false,
				Name:          `警报专题`,
				Action:        `alert_topic`,
			},
			{
				DisplayOnMenu: false,
				Name:          `关联收信账号`,
				Action:        `alert_topic_add`,
			},
			{
				DisplayOnMenu: false,
				Name:          `修改收信账号`,
				Action:        `alert_topic_edit`,
			},
			{
				DisplayOnMenu: false,
				Name:          `取消关联收信账号`,
				Action:        `alert_topic_delete`,
			},

			{
				DisplayOnMenu: true,
				Name:          `用户管理`,
				Action:        `user`,
			},
			{
				DisplayOnMenu: false,
				Name:          `添加用户`,
				Action:        `user_add`,
				Icon:          `plus`,
			},
			{
				DisplayOnMenu: false,
				Name:          `修改用户`,
				Action:        `user_edit`,
			},
			{
				DisplayOnMenu: false,
				Name:          `删除用户`,
				Action:        `user_delete`,
			},

			{
				DisplayOnMenu: true,
				Name:          `角色管理`,
				Action:        `role`,
			},
			{
				DisplayOnMenu: false,
				Name:          `添加角色`,
				Action:        `role_add`,
				Icon:          `plus`,
			},
			{
				DisplayOnMenu: false,
				Name:          `修改角色`,
				Action:        `role_edit`,
			},
			{
				DisplayOnMenu: false,
				Name:          `删除角色`,
				Action:        `role_delete`,
			},

			{
				DisplayOnMenu: true,
				Name:          `邀请码`,
				Action:        `invitation`,
			},
			{
				DisplayOnMenu: false,
				Name:          `添加邀请码`,
				Action:        `invitation_add`,
			},
			{
				DisplayOnMenu: false,
				Name:          `修改邀请码`,
				Action:        `invitation_edit`,
			},
			{
				DisplayOnMenu: false,
				Name:          `删除邀请码`,
				Action:        `invitation_delete`,
			},

			{
				DisplayOnMenu: true,
				Name:          `验证码`,
				Action:        `verification`,
			},
			{
				DisplayOnMenu: false,
				Name:          `删除验证码`,
				Action:        `verification_delete`,
			},
			{
				DisplayOnMenu: false,
				Name:          `上传图片`,
				Action:        `upload/:type`,
			},
			{
				DisplayOnMenu: true,
				Name:          `本地附件`,
				Action:        `uploaded_file`,
			},
		},
	},
	{
		DisplayOnMenu: true,
		Name:          `工具箱`,
		Action:        `tool`,
		Icon:          `suitcase`,
		Children: &List{
			{
				DisplayOnMenu: true,
				Name:          `IP归属地`,
				Action:        `ip`,
			},
			{
				DisplayOnMenu: true,
				Name:          `Base64解码`,
				Action:        `base64`,
			},
			{
				DisplayOnMenu: true,
				Name:          `URL解码`,
				Action:        `url`,
			},
			{
				DisplayOnMenu: true,
				Name:          `时间戳转换`,
				Action:        `timestamp`,
			},
			{
				DisplayOnMenu: true,
				Name:          `附件网址替换`,
				Action:        `replaceurl`,
			},
		},
	},
}

TopNavigate 顶部导航菜单

Functions

func ProjectAdd

func ProjectAdd(index int, list ...*ProjectItem)

func ProjectAddNavList

func ProjectAddNavList(name string, ident string, url string, navList *List)

func ProjectIdent

func ProjectIdent(urlPath string) string

func ProjectRemove

func ProjectRemove(index int)

func ProjectSearchIdent

func ProjectSearchIdent(ident string) int

func ProjectSet

func ProjectSet(index int, list ...*ProjectItem)

func ProjectURLsIdent

func ProjectURLsIdent() map[string]string

func TopNavURLs

func TopNavURLs() map[string]int

Types

type Item

type Item struct {
	DisplayOnMenu bool   `json:",omitempty" xml:",omitempty"` //是否在菜单三显示
	Name          string `json:",omitempty" xml:",omitempty"` //名称
	Action        string `json:",omitempty" xml:",omitempty"` //操作(一般为网址)
	Icon          string `json:",omitempty" xml:",omitempty"` //图标
	Target        string `json:",omitempty" xml:",omitempty"` //打开方式
	Unlimited     bool   `json:",omitempty" xml:",omitempty"` //是否不限制权限
	Children      *List  `json:",omitempty" xml:",omitempty"`
}

Item 操作

func (*Item) FullPath

func (a *Item) FullPath(parentPath string) string

type List

type List []*Item

List 操作列表

func (*List) Add

func (a *List) Add(index int, list ...*Item) *List

Add 添加列表项

func (*List) ChildrenBy

func (a *List) ChildrenBy(index int) *List

ChildrenBy 添加列表项

func (*List) FullPath

func (a *List) FullPath(parentPath string) []string

func (*List) Get

func (a *List) Get(index int) *Item

Get 添加列表项

func (*List) Remove

func (a *List) Remove(index int) *List

Remove 删除元素

func (*List) Set

func (a *List) Set(index int, list ...*Item) *List

Set 设置元素

func (*List) Size

func (a *List) Size() int

Size 子项数量

type ProjectItem

type ProjectItem struct {
	Name    string
	Ident   string
	URL     string
	NavList *List
}

func NewProject

func NewProject(name string, ident string, url string, navLists ...*List) *ProjectItem

func ProjectFirst

func ProjectFirst(notEmptyOpts ...bool) *ProjectItem

func ProjectGet

func ProjectGet(ident string) *ProjectItem

func (*ProjectItem) GetIdent

func (a *ProjectItem) GetIdent() string

func (*ProjectItem) GetName

func (a *ProjectItem) GetName() string

func (*ProjectItem) GetURL

func (a *ProjectItem) GetURL() string

func (*ProjectItem) Is

func (a *ProjectItem) Is(ident string) bool

type ProjectList

type ProjectList []*ProjectItem

func ProjectListAll

func ProjectListAll() ProjectList

func (*ProjectList) Add

func (a *ProjectList) Add(index int, list ...*ProjectItem) *ProjectList

Add 添加列表项

func (*ProjectList) Remove

func (a *ProjectList) Remove(index int) *ProjectList

Remove 删除元素

func (*ProjectList) SearchIdent

func (a *ProjectList) SearchIdent(ident string) int

func (*ProjectList) Set

func (a *ProjectList) Set(index int, list ...*ProjectItem) *ProjectList

Set 设置元素

type Projects

type Projects struct {
	List *ProjectList
	Hash map[string]*ProjectItem //项目标识(Ident)=>项目信息
	// contains filtered or unexported fields
}

func NewProjects

func NewProjects() *Projects

func ProjectInitURLsIdent

func ProjectInitURLsIdent() *Projects

func (*Projects) Add

func (p *Projects) Add(index int, list ...*ProjectItem) *Projects

func (*Projects) First

func (p *Projects) First(notEmptyOpts ...bool) *ProjectItem

func (*Projects) Get

func (p *Projects) Get(ident string) *ProjectItem

func (*Projects) InitURLsIdent

func (p *Projects) InitURLsIdent() *Projects

func (*Projects) Remove

func (p *Projects) Remove(index int) *Projects

func (*Projects) Set

func (p *Projects) Set(index int, list ...*ProjectItem) *Projects

func (*Projects) URLsIdent

func (p *Projects) URLsIdent() map[string]string

Jump to

Keyboard shortcuts

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