mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
🎨 Add Rollup column to database table view https://github.com/siyuan-note/siyuan/issues/9958
This commit is contained in:
parent
4fcc7f1b4c
commit
99218f400b
6 changed files with 35 additions and 10 deletions
|
@ -168,7 +168,7 @@ func IsNodeOCRed(node *ast.Node) (ret bool) {
|
|||
return
|
||||
}
|
||||
|
||||
func NodeStaticContent(node *ast.Node, excludeTypes []string, includeTextMarkATitleURL, includeAssetPath bool) string {
|
||||
func NodeStaticContent(node *ast.Node, excludeTypes []string, includeTextMarkATitleURL, includeAssetPath, fullAttrView bool) string {
|
||||
if nil == node {
|
||||
return ""
|
||||
}
|
||||
|
@ -178,7 +178,11 @@ func NodeStaticContent(node *ast.Node, excludeTypes []string, includeTextMarkATi
|
|||
}
|
||||
|
||||
if ast.NodeAttributeView == node.Type {
|
||||
return getAttributeViewContent(node.AttributeViewID)
|
||||
if fullAttrView {
|
||||
return getAttributeViewContent(node.AttributeViewID)
|
||||
}
|
||||
|
||||
return getAttributeViewName(node.AttributeViewID)
|
||||
}
|
||||
|
||||
buf := bytes.Buffer{}
|
||||
|
@ -528,6 +532,27 @@ func GetAttributeViewName(avID string) (name string) {
|
|||
return
|
||||
}
|
||||
|
||||
func getAttributeViewName(avID string) (name string) {
|
||||
if "" == avID {
|
||||
return
|
||||
}
|
||||
|
||||
attrView, err := av.ParseAttributeView(avID)
|
||||
if nil != err {
|
||||
logging.LogErrorf("parse attribute view [%s] failed: %s", avID, err)
|
||||
return
|
||||
}
|
||||
|
||||
buf := bytes.Buffer{}
|
||||
for _, v := range attrView.Views {
|
||||
buf.WriteString(v.Name)
|
||||
buf.WriteByte(' ')
|
||||
}
|
||||
|
||||
name = strings.TrimSpace(buf.String())
|
||||
return
|
||||
}
|
||||
|
||||
func getAttributeViewContent(avID string) (content string) {
|
||||
if "" == avID {
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue