mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
ba2f7272ca
2 changed files with 22 additions and 4 deletions
|
|
@ -88,6 +88,11 @@ func renderAttributeView(attrView *av.AttributeView, nodeID, viewID, query strin
|
||||||
}
|
}
|
||||||
|
|
||||||
func renderAttributeViewGroups(viewable av.Viewable, attrView *av.AttributeView, view *av.View, query string, page, pageSize int, groupPaging map[string]interface{}) (err error) {
|
func renderAttributeViewGroups(viewable av.Viewable, attrView *av.AttributeView, view *av.View, query string, page, pageSize int, groupPaging map[string]interface{}) (err error) {
|
||||||
|
groupKey := view.GetGroupKey(attrView)
|
||||||
|
if nil == groupKey {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 当前日期可能会变,所以如果是按日期分组则需要重新生成分组
|
// 当前日期可能会变,所以如果是按日期分组则需要重新生成分组
|
||||||
if isGroupByDate(view) {
|
if isGroupByDate(view) {
|
||||||
createdDate := time.UnixMilli(view.GroupCreated).Format("2006-01-02")
|
createdDate := time.UnixMilli(view.GroupCreated).Format("2006-01-02")
|
||||||
|
|
@ -97,9 +102,10 @@ func renderAttributeViewGroups(viewable av.Viewable, attrView *av.AttributeView,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
groupKey := view.GetGroupKey(attrView)
|
// 如果是按模板分组则需要重新生成分组
|
||||||
if nil == groupKey {
|
if isGroupByTemplate(attrView, view) {
|
||||||
return
|
regenAttrViewGroups(attrView)
|
||||||
|
av.SaveAttributeView(attrView)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果存在分组的话渲染分组视图
|
// 如果存在分组的话渲染分组视图
|
||||||
|
|
@ -352,6 +358,18 @@ func isGroupByDate(view *av.View) bool {
|
||||||
return av.GroupMethodDateDay == view.Group.Method || av.GroupMethodDateWeek == view.Group.Method || av.GroupMethodDateMonth == view.Group.Method || av.GroupMethodDateYear == view.Group.Method || av.GroupMethodDateRelative == view.Group.Method
|
return av.GroupMethodDateDay == view.Group.Method || av.GroupMethodDateWeek == view.Group.Method || av.GroupMethodDateMonth == view.Group.Method || av.GroupMethodDateYear == view.Group.Method || av.GroupMethodDateRelative == view.Group.Method
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isGroupByTemplate(attrView *av.AttributeView, view *av.View) bool {
|
||||||
|
if nil == view.Group {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
groupKey := view.GetGroupKey(attrView)
|
||||||
|
if nil == groupKey {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return av.KeyTypeTemplate == groupKey.Type
|
||||||
|
}
|
||||||
|
|
||||||
func renderViewableInstance(viewable av.Viewable, view *av.View, attrView *av.AttributeView, page, pageSize int) (err error) {
|
func renderViewableInstance(viewable av.Viewable, view *av.View, attrView *av.AttributeView, page, pageSize int) (err error) {
|
||||||
if nil == viewable {
|
if nil == viewable {
|
||||||
err = av.ErrViewNotFound
|
err = av.ErrViewNotFound
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ func RenderView(attrView *av.AttributeView, view *av.View, query string) (ret av
|
||||||
|
|
||||||
func renderView(attrView *av.AttributeView, view *av.View, query string,
|
func renderView(attrView *av.AttributeView, view *av.View, query string,
|
||||||
depth *int, cachedAttrViews map[string]*av.AttributeView) (ret av.Viewable) {
|
depth *int, cachedAttrViews map[string]*av.AttributeView) (ret av.Viewable) {
|
||||||
if 2 < *depth {
|
if 7 < *depth {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue