mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 The database template field supports using other template fields https://github.com/siyuan-note/siyuan/issues/15517
This commit is contained in:
parent
f0f5b6a824
commit
6e6522d56a
6 changed files with 50 additions and 47 deletions
|
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
func RenderAttributeViewGallery(attrView *av.AttributeView, view *av.View, query string,
|
||||
depth *int, renderedAttrViews map[string]*av.AttributeView, renderedTemplateKeyCollections map[string]av.Collection) (ret *av.Gallery) {
|
||||
depth *int, renderedAttrViews map[string]*av.AttributeView) (ret *av.Gallery) {
|
||||
ret = &av.Gallery{
|
||||
BaseInstance: av.NewViewBaseInstance(view),
|
||||
CoverFrom: view.Gallery.CoverFrom,
|
||||
|
|
@ -111,14 +111,17 @@ func RenderAttributeViewGallery(attrView *av.AttributeView, view *av.View, query
|
|||
ret.Cards = append(ret.Cards, &galleryCard)
|
||||
}
|
||||
|
||||
// 回填补全数据
|
||||
fillAttributeViewKeyValues(attrView, ret)
|
||||
|
||||
// 批量获取块属性以提升性能
|
||||
ials := BatchGetBlockAttrsWitTrees(ialIDs, boundTrees)
|
||||
|
||||
// 渲染自动生成的字段值,比如关联、汇总、创建时间和更新时间
|
||||
fillAttributeViewAutoGeneratedValues(attrView, ret, ials, cardsValues, depth, renderedAttrViews, renderedTemplateKeyCollections)
|
||||
fillAttributeViewAutoGeneratedValues(attrView, ret, ials, depth, renderedAttrViews)
|
||||
|
||||
// 最后单独渲染模板字段,这样模板就可以使用汇总、关联、创建时间和更新时间的值了
|
||||
renderTemplateErr := fillAttributeViewTemplateValues(attrView, ret, ials, cardsValues)
|
||||
renderTemplateErr := fillAttributeViewTemplateValues(attrView, view, ret, ials)
|
||||
if nil != renderTemplateErr {
|
||||
util.PushErrMsg(fmt.Sprintf(util.Langs[util.Lang][44], util.EscapeHTML(renderTemplateErr.Error())), 30000)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue