mirror of
https://github.com/quarkcloudio/quark-go.git
synced 2025-09-26 20:11:11 +08:00
38 lines
616 B
Go
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)
|
|
}
|