Added history tab to nearly all editable objects

This commit is contained in:
2018-03-13 17:59:16 +01:00
parent b3257e78b6
commit 12de621214
12 changed files with 138 additions and 10 deletions

View File

@ -2,7 +2,6 @@ package editlog
import (
"net/http"
"sort"
"github.com/animenotifier/arn"
@ -25,13 +24,12 @@ func Get(ctx *aero.Context) string {
entries := arn.AllEditLogEntries()
// Sort by creation date
sort.Slice(entries, func(i, j int) bool {
return entries[i].Created > entries[j].Created
})
arn.SortEditLogEntriesLatestFirst(entries)
// Limit results
if len(entries) > maxEntries {
entries = entries[:maxEntries]
}
return ctx.HTML(components.EditLog(entries, user))
return ctx.HTML(components.EditLogPage(entries, user))
}

View File

@ -1,6 +1,8 @@
component EditLog(entries []*arn.EditLogEntry, user *arn.User)
h1 Editor log
component EditLogPage(entries []*arn.EditLogEntry, user *arn.User)
h1.mountable Editor log
EditLog(entries, user)
component EditLog(entries []*arn.EditLogEntry, user *arn.User)
table.edit-log
thead
tr.mountable