58 lines
1.8 KiB
Plaintext
Raw Normal View History

2018-03-09 18:04:06 +00:00
component EditLog(entries []*arn.EditLogEntry, user *arn.User)
h1 Editor log
2018-03-09 18:53:21 +00:00
table.edit-log
2018-03-09 18:04:06 +00:00
thead
tr.mountable
2018-03-09 18:53:21 +00:00
th.text-center Icon
2018-03-09 18:04:06 +00:00
th User
th Object
2018-03-09 18:53:21 +00:00
th Key
2018-03-09 18:04:06 +00:00
th Old
th New
th Date
tbody
each entry in entries
tr.mountable
td
2018-03-09 19:13:43 +00:00
.edit-log-icon(title=entry.Action)
if entry.Action == "create"
.edit-log-create
2018-03-09 18:53:21 +00:00
RawIcon("plus")
2018-03-09 19:23:59 +00:00
else if entry.Action == "delete"
.edit-log-delete
RawIcon("minus")
2018-03-09 21:05:01 +00:00
else if entry.Action == "edit" || entry.Action == "arrayAppend" || entry.Action == "arrayRemove"
2018-03-09 18:53:21 +00:00
.edit-log-change
RawIcon("pencil")
2018-03-09 19:39:06 +00:00
2018-03-09 21:05:01 +00:00
if entry.Action == "arrayAppend"
2018-03-09 19:39:06 +00:00
.edit-log-sub-icon.edit-log-add
2018-03-09 21:05:01 +00:00
RawIcon("plus-square")
else if entry.Action == "arrayRemove"
2018-03-09 19:39:06 +00:00
.edit-log-sub-icon.edit-log-remove
2018-03-09 21:05:01 +00:00
RawIcon("minus-square")
else
if entry.OldValue == "" && entry.NewValue != ""
.edit-log-sub-icon.edit-log-add
RawIcon("plus-circle")
else if entry.OldValue != "" && entry.NewValue == ""
.edit-log-sub-icon.edit-log-remove
RawIcon("minus-circle")
2018-03-09 19:39:06 +00:00
2018-03-09 18:04:06 +00:00
td
2018-03-09 18:53:21 +00:00
.edit-log-user
Avatar(entry.User())
td.edit-log-object
2018-03-09 20:08:06 +00:00
if strings.HasPrefix(arn.GetObjectTitle(entry.ObjectType, entry.ObjectID), "<not found:")
span= arn.GetObjectTitle(entry.ObjectType, entry.ObjectID)
else
a(href="/" + strings.ToLower(entry.ObjectType) + "/" + entry.ObjectID, target="_blank")= arn.GetObjectTitle(entry.ObjectType, entry.ObjectID)
2018-03-09 19:39:06 +00:00
td.edit-log-key
span= entry.ObjectType
if entry.Key != ""
span= "." + entry.Key
2018-03-09 21:16:59 +00:00
td.edit-log-value(title=entry.OldValue)= entry.OldValue
td.edit-log-value(title=entry.NewValue)= entry.NewValue
2018-03-09 18:53:21 +00:00
td.edit-log-date.utc-date(data-date=entry.Created)