Files
quark-go/pkg/app/handler/admin/actions/create_link.go
tangtanglove 5244508c40 first commit
2023-01-18 13:40:07 +08:00

38 lines
616 B
Go

package actions
import (
"strings"
"github.com/quarkcms/quark-go/pkg/builder"
"github.com/quarkcms/quark-go/pkg/builder/actions"
)
type CreateLink struct {
actions.Link
}
// 初始化
func (p *CreateLink) Init(name string) *CreateLink {
// 初始化父结构
p.ParentInit()
// 类型
p.Type = "primary"
// 图标
p.Icon = "plus-circle"
// 文字
p.Name = "创建" + name
// 设置展示位置
p.SetOnlyOnIndex(true)
return p
}
// 跳转链接
func (p *CreateLink) GetHref(request *builder.Request) string {
return "#/index?api=" + strings.Replace(request.Path(), "/index", "/create", -1)
}