Improved edit log

This commit is contained in:
Eduard Urbach 2018-03-09 19:53:21 +01:00
parent 679566eb5b
commit ef7fe29fab
3 changed files with 53 additions and 6 deletions

View File

@ -1,23 +1,36 @@
component EditLog(entries []*arn.EditLogEntry, user *arn.User) component EditLog(entries []*arn.EditLogEntry, user *arn.User)
h1 Editor log h1 Editor log
table table.edit-log
thead thead
tr.mountable tr.mountable
th ID th.text-center Icon
th User th User
th Object th Object
th Key
th Old th Old
th New th New
th Date th Date
tbody tbody
each entry in entries each entry in entries
tr.mountable tr.mountable
td= entry.ID
td td
a(href=entry.User().Link(), target="_blank", rel="noopener")= entry.User().Nick .edit-log-icon
if entry.OldValue == "" && entry.NewValue != ""
.edit-log-add
RawIcon("plus")
else if entry.OldValue != "" && entry.NewValue == ""
.edit-log-remove
RawIcon("minus")
else
.edit-log-change
RawIcon("pencil")
td td
a(href="/" + strings.ToLower(entry.ObjectType) + "/" + entry.ObjectID, target="_blank")= entry.ObjectType + " " + entry.ObjectID .edit-log-user
Avatar(entry.User())
td.edit-log-object
a(href="/" + strings.ToLower(entry.ObjectType) + "/" + entry.ObjectID, target="_blank")= arn.GetObjectTitle(entry.ObjectType, entry.ObjectID)
td.edit-log-key= entry.Key
td= entry.OldValue td= entry.OldValue
td= entry.NewValue td= entry.NewValue
td.utc-date(data-date=entry.Created) td.edit-log-date.utc-date(data-date=entry.Created)

View File

@ -0,0 +1,33 @@
.edit-log
max-width 1500px
td
padding 0.25rem 0.5rem
.edit-log-object,
.edit-log-key,
.edit-log-date
white-space nowrap
.edit-log-user
.user-image
width calc(avatar-size / 2)
height calc(avatar-size / 2)
margin-right 0.5rem
.edit-log-icon
display flex
justify-content center
align-items center
.edit-log-add
color green
.edit-log-remove
color red
.edit-log-change
color main-color
.edit-log-date
opacity 0.5

View File

@ -297,6 +297,7 @@ var routeTests = map[string][]string{
"/shop/history": nil, "/shop/history": nil,
"/support": nil, "/support": nil,
"/charge": nil, "/charge": nil,
"/log": nil,
"/inventory": nil, "/inventory": nil,
"/extension/embed": nil, "/extension/embed": nil,
} }