mirror of
https://shylinux.com/x/icebergs
synced 2025-06-26 18:37:29 +08:00
add icon
This commit is contained in:
parent
c356669ff5
commit
b3520df582
@ -147,27 +147,13 @@ var Index = &ice.Context{Name: MDB, Help: "数据模块", Commands: ice.Commands
|
|||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {}},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {}},
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {}},
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {}},
|
||||||
INPUTS: {Name: "inputs key sub type field value", Hand: func(m *ice.Message, arg ...string) {
|
INPUTS: {Name: "inputs key sub type field value", Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[3] {
|
kit.Switch(arg[2],
|
||||||
case "space":
|
HASH, func() { _hash_inputs(m, arg[0], arg[1], kit.Select(NAME, arg, 3), kit.Select("", arg, 4)) },
|
||||||
m.Cmd("space", func(value ice.Maps) {
|
ZONE, func() { _zone_inputs(m, arg[0], arg[1], arg[3], kit.Select(NAME, arg, 4), kit.Select("", arg, 5)) },
|
||||||
kit.If(kit.IsIn(value[TYPE], "worker", "server"), func() { m.Push(arg[3], value[NAME]) })
|
LIST, func() { _list_inputs(m, arg[0], arg[1], kit.Select(NAME, arg, 3), kit.Select("", arg, 4)) },
|
||||||
})
|
)
|
||||||
case "index":
|
for _, inputs := range ice.Info.Inputs {
|
||||||
if space := m.Option("space"); space != "" {
|
inputs(m, arg[3])
|
||||||
m.Options("space", []string{}).Cmdy("space", space, INPUTS, arg)
|
|
||||||
} else {
|
|
||||||
m.Cmdy("command")
|
|
||||||
}
|
|
||||||
case "args":
|
|
||||||
m.Cmdy("command", INPUTS, m.Option("index"))
|
|
||||||
case ICON:
|
|
||||||
m.Cmdy("nfs.dir", "usr/icons/", "path")
|
|
||||||
default:
|
|
||||||
kit.Switch(arg[2],
|
|
||||||
HASH, func() { _hash_inputs(m, arg[0], arg[1], kit.Select(NAME, arg, 3), kit.Select("", arg, 4)) },
|
|
||||||
ZONE, func() { _zone_inputs(m, arg[0], arg[1], arg[3], kit.Select(NAME, arg, 4), kit.Select("", arg, 5)) },
|
|
||||||
LIST, func() { _list_inputs(m, arg[0], arg[1], kit.Select(NAME, arg, 3), kit.Select("", arg, 4)) },
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
INSERT: {Name: "insert key sub type arg...", Hand: func(m *ice.Message, arg ...string) {
|
INSERT: {Name: "insert key sub type arg...", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
@ -175,6 +175,28 @@ const (
|
|||||||
const SPACE = "space"
|
const SPACE = "space"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
ice.Info.Inputs = append(ice.Info.Inputs, func(m *ice.Message, arg ...string) {
|
||||||
|
switch arg[0] {
|
||||||
|
case SPACE:
|
||||||
|
m.Cmd(SPACE, func(value ice.Maps) {
|
||||||
|
kit.If(kit.IsIn(value[mdb.TYPE], WORKER, SERVER), func() { m.Push(arg[0], value[mdb.NAME]) })
|
||||||
|
})
|
||||||
|
case mdb.ICON:
|
||||||
|
m.Cmdy(nfs.DIR, "usr/icons/", nfs.PATH)
|
||||||
|
case ctx.INDEX:
|
||||||
|
if space := m.Option(SPACE); space != "" {
|
||||||
|
m.Options(SPACE, []string{}).Cmdy(SPACE, space, mdb.INPUTS, arg)
|
||||||
|
} else {
|
||||||
|
m.Cmdy(ctx.COMMAND)
|
||||||
|
}
|
||||||
|
case ctx.ARGS:
|
||||||
|
if space := m.Option(SPACE); space != "" {
|
||||||
|
m.Options(SPACE, []string{}).Cmdy(SPACE, space, ctx.COMMAND, mdb.INPUTS, m.Option(ctx.INDEX))
|
||||||
|
} else {
|
||||||
|
m.Cmdy(ctx.COMMAND, mdb.INPUTS, m.Option(ctx.INDEX))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
SPACE: {Name: "space name cmds auto", Help: "空间站", Actions: ice.MergeActions(ice.Actions{
|
SPACE: {Name: "space name cmds auto", Help: "空间站", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { aaa.White(m, SPACE, ice.MAIN) }},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { aaa.White(m, SPACE, ice.MAIN) }},
|
||||||
|
26
core/chat/icons.go
Normal file
26
core/chat/icons.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package chat
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
ice "shylinux.com/x/icebergs"
|
||||||
|
"shylinux.com/x/icebergs/base/lex"
|
||||||
|
kit "shylinux.com/x/toolkits"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
const ICONS = "icons"
|
||||||
|
Index.MergeCommands(ice.Commands{
|
||||||
|
ICONS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Option(lex.SPLIT_SPACE, " {:;}")
|
||||||
|
m.Cmd(lex.SPLIT, "usr/node_modules/bootstrap-icons/font/bootstrap-icons.css", func(text string, ls []string) {
|
||||||
|
if len(ls) > 2 && ls[2] == "content" {
|
||||||
|
name := "bi " + strings.TrimPrefix(ls[0], ".")
|
||||||
|
m.Push("name", name)
|
||||||
|
m.Push("icon", kit.Format(`<i class="%s"></i>`, name))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
m.StatusTimeCount()
|
||||||
|
}},
|
||||||
|
})
|
||||||
|
}
|
@ -20,7 +20,6 @@ func init() {
|
|||||||
DeskAppend(m, "usr/icons/Photos.png", web.WIKI_FEEL)
|
DeskAppend(m, "usr/icons/Photos.png", web.WIKI_FEEL)
|
||||||
DeskAppend(m, "usr/icons/Grapher.png", web.WIKI_DRAW)
|
DeskAppend(m, "usr/icons/Grapher.png", web.WIKI_DRAW)
|
||||||
DeskAppend(m, "usr/icons/Calendar.png", web.TEAM_PLAN)
|
DeskAppend(m, "usr/icons/Calendar.png", web.TEAM_PLAN)
|
||||||
DeskAppend(m, "usr/icons/flows.png", web.CHAT_FLOWS)
|
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { mdb.HashExport(m) }},
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { mdb.HashExport(m) }},
|
||||||
|
@ -3,7 +3,6 @@ package chat
|
|||||||
import (
|
import (
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
|
||||||
"shylinux.com/x/icebergs/base/gdb"
|
"shylinux.com/x/icebergs/base/gdb"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
@ -48,12 +47,6 @@ func init() {
|
|||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case nfs.TEMPLATE:
|
case nfs.TEMPLATE:
|
||||||
m.Cmdy(TEMPLATE).CutTo(RIVER, arg[0])
|
m.Cmdy(TEMPLATE).CutTo(RIVER, arg[0])
|
||||||
case web.SPACE:
|
|
||||||
m.Cmdy(web.SPACE).CutTo(mdb.NAME, arg[0])
|
|
||||||
case ctx.INDEX:
|
|
||||||
m.Cmdy(web.Space(m, m.Option(web.SPACE)), ctx.COMMAND)
|
|
||||||
case ctx.ARGS:
|
|
||||||
m.Cmdy(web.Space(m, m.Option(web.SPACE)), ctx.COMMAND, mdb.INPUTS, m.Option(ctx.INDEX))
|
|
||||||
default:
|
default:
|
||||||
mdb.HashInputs(m, arg)
|
mdb.HashInputs(m, arg)
|
||||||
}
|
}
|
||||||
|
1
info.go
1
info.go
@ -74,6 +74,7 @@ var Info = struct {
|
|||||||
OpenFile func(m *Message, p string) (io.ReadCloser, error)
|
OpenFile func(m *Message, p string) (io.ReadCloser, error)
|
||||||
PushStream func(m *Message)
|
PushStream func(m *Message)
|
||||||
PushNotice func(m *Message, arg ...Any)
|
PushNotice func(m *Message, arg ...Any)
|
||||||
|
Inputs []func(m *Message, arg ...string)
|
||||||
Load func(m *Message, key ...string) *Message
|
Load func(m *Message, key ...string) *Message
|
||||||
Save func(m *Message, key ...string) *Message
|
Save func(m *Message, key ...string) *Message
|
||||||
Log func(m *Message, p, l, s string)
|
Log func(m *Message, p, l, s string)
|
||||||
|
1
type.go
1
type.go
@ -174,6 +174,7 @@ func (c *Context) Merge(s *Context) *Context {
|
|||||||
kit.If(action.List == nil, func() { action.List = SplitCmd(action.Name, nil) })
|
kit.If(action.List == nil, func() { action.List = SplitCmd(action.Name, nil) })
|
||||||
kit.If(len(action.List) > 0, func() { cmd.Meta[sub] = action.List })
|
kit.If(len(action.List) > 0, func() { cmd.Meta[sub] = action.List })
|
||||||
}
|
}
|
||||||
|
kit.If(cmd.Name == "", func() { cmd.Name = "list path auto" })
|
||||||
kit.If(strings.HasPrefix(cmd.Name, "list"), func() { cmd.Name = strings.Replace(cmd.Name, "list", key, 1) })
|
kit.If(strings.HasPrefix(cmd.Name, "list"), func() { cmd.Name = strings.Replace(cmd.Name, "list", key, 1) })
|
||||||
kit.If(cmd.List == nil, func() { cmd.List = SplitCmd(cmd.Name, cmd.Actions) })
|
kit.If(cmd.List == nil, func() { cmd.List = SplitCmd(cmd.Name, cmd.Actions) })
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user