mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
🎨 Improve av https://github.com/siyuan-note/siyuan/issues/15498
This commit is contained in:
parent
c1682895ef
commit
96346a94ad
3 changed files with 10 additions and 5 deletions
|
@ -174,7 +174,7 @@ func sortAttributeViewGroup(avID, blockID, previousGroupID, groupID string) (err
|
|||
return err
|
||||
}
|
||||
|
||||
sortGroupViews(time.Now(), view)
|
||||
sortGroupViews(view)
|
||||
|
||||
var groupView *av.View
|
||||
var index, previousIndex int
|
||||
|
|
|
@ -137,9 +137,7 @@ func renderAttributeViewGroups(viewable av.Viewable, attrView *av.AttributeView,
|
|||
}
|
||||
}
|
||||
|
||||
todayStart := time.Now()
|
||||
todayStart = time.Date(todayStart.Year(), todayStart.Month(), todayStart.Day(), 0, 0, 0, 0, time.Local)
|
||||
sortGroupViews(todayStart, view)
|
||||
sortGroupViews(view)
|
||||
|
||||
var groups []av.Viewable
|
||||
for _, groupView := range view.Groups {
|
||||
|
@ -195,7 +193,7 @@ func hideEmptyGroupViews(view *av.View, viewable av.Viewable) {
|
|||
}
|
||||
}
|
||||
|
||||
func sortGroupViews(todayStart time.Time, view *av.View) {
|
||||
func sortGroupViews(view *av.View) {
|
||||
if av.GroupOrderMan == view.Group.Order {
|
||||
sort.Slice(view.Groups, func(i, j int) bool { return view.Groups[i].GroupSort < view.Groups[j].GroupSort })
|
||||
return
|
||||
|
@ -259,6 +257,7 @@ func sortGroupViews(todayStart time.Time, view *av.View) {
|
|||
}
|
||||
|
||||
startIdx := -1
|
||||
todayStart := util.GetTodayStart()
|
||||
thisMonth := todayStart.Format("2006-01")
|
||||
for i, monthGroup := range relativeDateGroups {
|
||||
if monthGroup.GetGroupValue() < thisMonth {
|
||||
|
|
|
@ -26,6 +26,12 @@ import (
|
|||
"github.com/88250/go-humanize"
|
||||
)
|
||||
|
||||
func GetTodayStart() (ret time.Time) {
|
||||
ret = time.Now()
|
||||
ret = time.Date(ret.Year(), ret.Month(), ret.Day(), 0, 0, 0, 0, time.Local)
|
||||
return
|
||||
}
|
||||
|
||||
// Weekday returns the day of the week specified by date.
|
||||
// Sunday=0, Monday=1, ..., Saturday=6.
|
||||
func Weekday(date time.Time) int {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue