mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
♻️ Refactor av render
This commit is contained in:
parent
34647490f2
commit
f4699c9fad
3 changed files with 175 additions and 164 deletions
|
|
@ -114,24 +114,10 @@ func RenderAttributeViewGallery(attrView *av.AttributeView, view *av.View, query
|
|||
ials := BatchGetBlockAttrsWitTrees(ialIDs, boundTrees)
|
||||
|
||||
// 渲染自动生成的字段值,比如关联字段、汇总字段、创建时间字段和更新时间字段
|
||||
avCache := map[string]*av.AttributeView{}
|
||||
avCache[attrView.ID] = attrView
|
||||
for _, card := range ret.Cards {
|
||||
for _, value := range card.Values {
|
||||
fillAttributeViewAutoGeneratedValues(attrView, ials, value.Value, card, cardsValues, &avCache)
|
||||
}
|
||||
}
|
||||
fillAttributeViewAutoGeneratedValues(attrView, ret, ials, cardsValues)
|
||||
|
||||
// 最后单独渲染模板字段,这样模板字段就可以使用汇总、关联、创建时间和更新时间字段的值了
|
||||
var renderTemplateErr error
|
||||
for _, card := range ret.Cards {
|
||||
for _, value := range card.Values {
|
||||
err := fillAttributeViewTemplateValue(value.Value, card, attrView, ials, cardsValues)
|
||||
if nil != err {
|
||||
renderTemplateErr = err
|
||||
}
|
||||
}
|
||||
}
|
||||
renderTemplateErr := fillAttributeViewTemplateValues(attrView, ret, ials, cardsValues)
|
||||
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